mirror of
https://github.com/zeldaret/ss
synced 2026-07-08 22:04:41 -04:00
updated nw4r stuff from ogw (not final)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
@@ -13,28 +13,27 @@
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
|
||||
#if defined(i386) || defined(i486) || \
|
||||
defined(intel) || defined(x86) || defined(i86pc) || \
|
||||
defined(__alpha) || defined(__osf__)
|
||||
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc) || defined(__alpha) || \
|
||||
defined(__osf__)
|
||||
#define __LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define __HI(x) *(1+(int*)&x)
|
||||
#define __LO(x) *(int*)&x
|
||||
#define __HIp(x) *(1+(int*)x)
|
||||
#define __LOp(x) *(int*)x
|
||||
#define __HI(x) *(1 + (int *)&x)
|
||||
#define __LO(x) *(int *)&x
|
||||
#define __HIp(x) *(1 + (int *)x)
|
||||
#define __LOp(x) *(int *)x
|
||||
#else
|
||||
#define __HI(x) *(int*)&x
|
||||
#define __LO(x) *(1+(int*)&x)
|
||||
#define __HIp(x) *(int*)x
|
||||
#define __LOp(x) *(1+(int*)x)
|
||||
#define __HI(x) *(int *)&x
|
||||
#define __LO(x) *(1 + (int *)&x)
|
||||
#define __HIp(x) *(int *)x
|
||||
#define __LOp(x) *(1 + (int *)x)
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#define __P(p) p
|
||||
#define __P(p) p
|
||||
#else
|
||||
#define __P(p) ()
|
||||
#define __P(p) ()
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -43,50 +42,50 @@
|
||||
|
||||
extern int signgam;
|
||||
|
||||
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
||||
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
||||
|
||||
enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
|
||||
enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
|
||||
|
||||
#define _LIB_VERSION_TYPE enum fdversion
|
||||
#define _LIB_VERSION _fdlib_version
|
||||
#define _LIB_VERSION _fdlib_version
|
||||
|
||||
/* if global variable _LIB_VERSION is not desirable, one may
|
||||
* change the following to be a constant by:
|
||||
/* if global variable _LIB_VERSION is not desirable, one may
|
||||
* change the following to be a constant by:
|
||||
* #define _LIB_VERSION_TYPE const enum version
|
||||
* In that case, after one initializes the value _LIB_VERSION (see
|
||||
* s_lib_version.c) during compile time, it cannot be modified
|
||||
* in the middle of a program
|
||||
*/
|
||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
*/
|
||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#define _IEEE_ fdlibm_ieee
|
||||
#define _SVID_ fdlibm_svid
|
||||
#define _IEEE_ fdlibm_ieee
|
||||
#define _SVID_ fdlibm_svid
|
||||
#define _XOPEN_ fdlibm_xopen
|
||||
#define _POSIX_ fdlibm_posix
|
||||
|
||||
struct exception {
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
|
||||
#define HUGE MAXFLOAT
|
||||
#define HUGE MAXFLOAT
|
||||
|
||||
/*
|
||||
/*
|
||||
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
|
||||
* (one may replace the following line by "#include <values.h>")
|
||||
*/
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
/*
|
||||
* ANSI/POSIX
|
||||
@@ -173,44 +172,44 @@ extern double log1p __P((double));
|
||||
#ifdef _REENTRANT
|
||||
extern double gamma_r __P((double, int *));
|
||||
extern double lgamma_r __P((double, int *));
|
||||
#endif /* _REENTRANT */
|
||||
#endif /* _REENTRANT */
|
||||
|
||||
/* ieee style elementary functions */
|
||||
extern double __ieee754_sqrt __P((double));
|
||||
extern double __ieee754_acos __P((double));
|
||||
extern double __ieee754_acosh __P((double));
|
||||
extern double __ieee754_log __P((double));
|
||||
extern double __ieee754_atanh __P((double));
|
||||
extern double __ieee754_asin __P((double));
|
||||
extern double __ieee754_atan2 __P((double,double));
|
||||
extern double __ieee754_sqrt __P((double));
|
||||
extern double __ieee754_acos __P((double));
|
||||
extern double __ieee754_acosh __P((double));
|
||||
extern double __ieee754_log __P((double));
|
||||
extern double __ieee754_atanh __P((double));
|
||||
extern double __ieee754_asin __P((double));
|
||||
extern double __ieee754_atan2 __P((double, double));
|
||||
extern double __ieee754_exp __P((double));
|
||||
extern double __ieee754_cosh __P((double));
|
||||
extern double __ieee754_fmod __P((double,double));
|
||||
extern double __ieee754_pow __P((double,double));
|
||||
extern double __ieee754_lgamma_r __P((double,int *));
|
||||
extern double __ieee754_gamma_r __P((double,int *));
|
||||
extern double __ieee754_fmod __P((double, double));
|
||||
extern double __ieee754_pow __P((double, double));
|
||||
extern double __ieee754_lgamma_r __P((double, int *));
|
||||
extern double __ieee754_gamma_r __P((double, int *));
|
||||
extern double __ieee754_lgamma __P((double));
|
||||
extern double __ieee754_gamma __P((double));
|
||||
extern double __ieee754_log10 __P((double));
|
||||
extern double __ieee754_sinh __P((double));
|
||||
extern double __ieee754_hypot __P((double,double));
|
||||
extern double __ieee754_hypot __P((double, double));
|
||||
extern double __ieee754_j0 __P((double));
|
||||
extern double __ieee754_j1 __P((double));
|
||||
extern double __ieee754_y0 __P((double));
|
||||
extern double __ieee754_y1 __P((double));
|
||||
extern double __ieee754_jn __P((int,double));
|
||||
extern double __ieee754_yn __P((int,double));
|
||||
extern double __ieee754_remainder __P((double,double));
|
||||
extern int __ieee754_rem_pio2 __P((double,double*));
|
||||
extern double __ieee754_jn __P((int, double));
|
||||
extern double __ieee754_yn __P((int, double));
|
||||
extern double __ieee754_remainder __P((double, double));
|
||||
extern int __ieee754_rem_pio2 __P((double, double *));
|
||||
#ifdef _SCALB_INT
|
||||
extern double __ieee754_scalb __P((double,int));
|
||||
extern double __ieee754_scalb __P((double, int));
|
||||
#else
|
||||
extern double __ieee754_scalb __P((double,double));
|
||||
extern double __ieee754_scalb __P((double, double));
|
||||
#endif
|
||||
|
||||
/* fdlibm kernel function */
|
||||
extern double __kernel_standard __P((double,double,int));
|
||||
extern double __kernel_sin __P((double,double,int));
|
||||
extern double __kernel_cos __P((double,double));
|
||||
extern double __kernel_tan __P((double,double,int));
|
||||
extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
|
||||
extern double __kernel_standard __P((double, double, int));
|
||||
extern double __kernel_sin __P((double, double, int));
|
||||
extern double __kernel_cos __P((double, double));
|
||||
extern double __kernel_tan __P((double, double, int));
|
||||
extern int __kernel_rem_pio2 __P((double *, double *, int, int, int, const int *));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef MSL_LIMITS_H
|
||||
#define MSL_LIMITS_H
|
||||
#include <common.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CHAR_BIT 8
|
||||
|
||||
#define SCHAR_MIN -127
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
|
||||
#define SHRT_MIN -32767
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
#define INT_MIN -2147483647
|
||||
#define INT_MAX 2147483647
|
||||
|
||||
#define LONG_MIN INT_MIN
|
||||
#define LONG_MAX INT_MAX
|
||||
#define ULONG_MAX 4294967295
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef MSL_WMEM_H
|
||||
#define MSL_WMEM_H
|
||||
#include <common.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void *wmemcpy(void *, const void *, size_t);
|
||||
void *wmemchr(const void *, int, size_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef MSL_WPRINTF_H
|
||||
#define MSL_WPRINTF_H
|
||||
#include <common.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int vswprintf(wchar_t *, size_t, const wchar_t *, va_list);
|
||||
int swprintf(wchar_t *, size_t, const wchar_t *, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef MSL_WSTRING_H
|
||||
#define MSL_WSTRING_H
|
||||
#include <common.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t wcslen(const wchar_t *);
|
||||
wchar_t *wcscpy(wchar_t *, const wchar_t *);
|
||||
wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
|
||||
wchar_t *wcscat(wchar_t *, const wchar_t *);
|
||||
int wcscmp(const wchar_t *, const wchar_t *);
|
||||
wchar_t *wcschr(const wchar_t *, wchar_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef MSL_LIMITS_H
|
||||
#define MSL_LIMITS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CHAR_BIT 8
|
||||
|
||||
#define SCHAR_MIN -127
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
|
||||
#define SHRT_MIN -32767
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
#define INT_MIN -2147483647
|
||||
#define INT_MAX 2147483647
|
||||
|
||||
#define LONG_MIN INT_MIN
|
||||
#define LONG_MAX INT_MAX
|
||||
#define ULONG_MAX 4294967295
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+39
-27
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/float.h"
|
||||
|
||||
#define NAN (*(float*)__float_nan)
|
||||
#define HUGE_VALF (*(float*)__float_huge)
|
||||
#define NAN (*(float *)__float_nan)
|
||||
#define HUGE_VALF (*(float *)__float_huge)
|
||||
|
||||
#define M_PI 3.14159265358979323846f
|
||||
|
||||
@@ -25,6 +25,21 @@ double copysign(double, double);
|
||||
double cos(double);
|
||||
float cosf(float);
|
||||
double exp(double);
|
||||
double ceil(double);
|
||||
float ceilf(float);
|
||||
double frexp(double, int *);
|
||||
double ldexp(double, int);
|
||||
double modf(double, double *);
|
||||
double pow(double, double);
|
||||
double sin(double);
|
||||
float sinf(float);
|
||||
double tan(double);
|
||||
float tanf(float);
|
||||
double floor(double);
|
||||
float floorf(float);
|
||||
double fmod(double, double);
|
||||
float fmodf(float, float);
|
||||
float fmodff(float, float *);
|
||||
|
||||
extern float __fabsf(float);
|
||||
inline double fabs(double f) {
|
||||
@@ -37,21 +52,19 @@ inline float fabsf(float f) {
|
||||
return fabsf2(f);
|
||||
}
|
||||
|
||||
double floor(double);
|
||||
double fmod(double, double);
|
||||
inline float fmodf(float f1, float f2) {
|
||||
return fmod(f1, f2);
|
||||
}
|
||||
|
||||
double frexp(double, int*);
|
||||
double ldexp(double, int);
|
||||
double modf(double, double*);
|
||||
double pow(double, double);
|
||||
double sin(double);
|
||||
float sinf(float);
|
||||
double tan(double);
|
||||
float tanf(float);
|
||||
inline float modff(float x, float *iptr) {
|
||||
float frac;
|
||||
double intg;
|
||||
|
||||
frac = modf((double)x, &intg);
|
||||
*iptr = intg;
|
||||
|
||||
return frac;
|
||||
}
|
||||
inline double sqrt_step(double tmpd, float mag) {
|
||||
return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd));
|
||||
}
|
||||
@@ -61,10 +74,10 @@ extern inline float sqrtf(float x) {
|
||||
const double _three = 3.0;
|
||||
volatile float y;
|
||||
if (x > 0.0f) {
|
||||
double guess = __frsqrte((double)x); // returns an approximation to
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
|
||||
double guess = __frsqrte((double)x); // returns an approximation to
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
|
||||
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
|
||||
y = (float)(x * guess);
|
||||
return y;
|
||||
}
|
||||
@@ -72,19 +85,18 @@ extern inline float sqrtf(float x) {
|
||||
}
|
||||
|
||||
extern inline double sqrt(double x) {
|
||||
if(x > 0.0)
|
||||
{
|
||||
double guess = __frsqrte(x); /* returns an approximation to */
|
||||
guess = .5*guess*(3.0 - guess*guess*x); /* now have 8 sig bits */
|
||||
guess = .5*guess*(3.0 - guess*guess*x); /* now have 16 sig bits */
|
||||
guess = .5*guess*(3.0 - guess*guess*x); /* now have 32 sig bits */
|
||||
guess = .5*guess*(3.0 - guess*guess*x); /* now have > 53 sig bits */
|
||||
return x*guess ;
|
||||
}
|
||||
else if ( x == 0 )
|
||||
if (x > 0.0) {
|
||||
double guess = __frsqrte(x); /* returns an approximation to */
|
||||
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
|
||||
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
|
||||
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
|
||||
guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */
|
||||
return x * guess;
|
||||
} else if (x == 0) {
|
||||
return 0;
|
||||
else if ( x )
|
||||
} else if (x) {
|
||||
return NAN;
|
||||
}
|
||||
|
||||
return HUGE_VALF;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef MSL_WCHAR_H
|
||||
#define MSL_WCHAR_H
|
||||
#include <common.h>
|
||||
|
||||
#include <MSL_C/MSL_Common/Src/mbstring.h>
|
||||
#include <MSL_C/MSL_Common/Src/wprintf.h>
|
||||
#include <MSL_C/MSL_Common/Src/wstring.h>
|
||||
#include <MSL_C/limits.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WCHAR_MIN SHRT_MIN
|
||||
#define WCHAR_MAX USHRT_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -42,6 +42,8 @@
|
||||
#define CW_FORCE_STRINGS(module, ...)
|
||||
#endif
|
||||
|
||||
#include <decomp.h>
|
||||
|
||||
// For VSCode
|
||||
#ifdef __INTELLISENSE__
|
||||
#define asm
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Codewarrior tricks for matching decomp
|
||||
* (Macros generate prototypes to satisfy -requireprotos)
|
||||
*/
|
||||
|
||||
#ifndef DECOMP_H
|
||||
#define DECOMP_H
|
||||
|
||||
#define __CONCAT(x, y) x##y
|
||||
#define CONCAT(x, y) __CONCAT(x, y)
|
||||
|
||||
// Compile without matching hacks.
|
||||
#ifdef NON_MATCHING
|
||||
#define DECOMP_FORCEACTIVE(module, ...)
|
||||
#define DECOMP_FORCELITERAL(module, x)
|
||||
#define DECOMP_FORCEDTOR(module, cls)
|
||||
#define DECOMP_INLINE
|
||||
#define DECOMP_DONT_INLINE
|
||||
// Compile with matching hacks.
|
||||
// (This version of CW does not support pragmas inside macros.)
|
||||
#else
|
||||
// Force reference specific data
|
||||
#define DECOMP_FORCEACTIVE(module, ...) \
|
||||
void fake_function(...); \
|
||||
void CONCAT(FORCEACTIVE##module, __LINE__)(void); \
|
||||
void CONCAT(FORCEACTIVE##module, __LINE__)(void) { \
|
||||
fake_function(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
// Force literal ordering, such as floats in sdata2
|
||||
#define DECOMP_FORCELITERAL(module, ...) \
|
||||
void CONCAT(FORCELITERAL##module, __LINE__)(void); \
|
||||
void CONCAT(FORCELITERAL##module, __LINE__)(void) { \
|
||||
(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
// Force reference destructor
|
||||
#define DECOMP_FORCEDTOR(module, cls) \
|
||||
void CONCAT(FORCEDTOR##module##cls, __LINE__)(void) { \
|
||||
cls dummy; \
|
||||
dummy.~cls(); \
|
||||
}
|
||||
#define DECOMP_INLINE inline
|
||||
#define DECOMP_DONT_INLINE __attribute__((never_inline))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#include "egg/core/eggFader.h"
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "nw4r/ut/Color.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class ColorFader : public Fader {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "egg/core/eggSystem.h" // for BaseSystem config
|
||||
#include "egg/core/eggVideo.h"
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "nw4r/ut/Color.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/VI.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// This file was adapted from https://github.com/riidefi/mkw/blob/master/source/egg/core/eggDisposer.hpp
|
||||
|
||||
#include "nw4r/ut/List.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include <common.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "egg/core/eggFile.h"
|
||||
#include "nw4r/ut/List.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/DVD.h"
|
||||
#include "rvl/OS.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class DvdFile : public File {
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
#include "egg/core/eggDisposer.h"
|
||||
#include "egg/core/eggThread.h"
|
||||
#include "egg/prim/eggBitFlag.h"
|
||||
#include "nw4r/ut/List.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/MEM.h"
|
||||
#include "rvl/OS.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
// class ExpHeap;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "nw4r/ut/List.h"
|
||||
#include "nw4r/ut.h"
|
||||
#include "rvl/OS.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class Thread {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
#include "MSL_C/float.h"
|
||||
#include "egg/math/eggMath.h"
|
||||
#include "nw4r/math/vec.h"
|
||||
#include <common.h>
|
||||
#include <nw4r/math.h>
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef NW4R_EF_ANIMCURVE_H
|
||||
#define NW4R_EF_ANIMCURVE_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
UNKTYPE AnimCurveExecuteF32(u8 *, float *, u32, u16, u32);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef NW4R_EF_CREATIONQUEUE
|
||||
#define NW4R_EF_CREATIONQUEUE
|
||||
#include "ef_emitter.h"
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
enum CreationType
|
||||
{
|
||||
CreationType_Particle,
|
||||
CreationType_Emitter
|
||||
};
|
||||
|
||||
//sizeof(UNK_CREATIONQUEUE) = 0x14
|
||||
struct Creation
|
||||
{
|
||||
u8 mType; // at 0x0
|
||||
u16 SHORT_0x2;
|
||||
EmitterInheritSetting mInheritSetting; // at 0x4
|
||||
Particle * mParticle; // at 0x8
|
||||
EmitterResource * mResource; // at 0xc
|
||||
};
|
||||
|
||||
struct CreationQueue
|
||||
{
|
||||
CreationQueue();
|
||||
void AddParticleCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
|
||||
void AddEmitterCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
|
||||
|
||||
int mSize;
|
||||
|
||||
Creation mCreations[0x400];
|
||||
|
||||
inline bool IsEmpty()
|
||||
{
|
||||
return mSize == 0;
|
||||
}
|
||||
|
||||
void Execute();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_CUBE_H
|
||||
#define NW4R_EF_CUBE_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormCube : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_CYLINDER_H
|
||||
#define NW4R_EF_CYLINDER_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormCylinder : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_DISC_H
|
||||
#define NW4R_EF_DISC_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormDisc : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_DRAW_BILLBOARD_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_BILLBOARD_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawBillboardStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawBillboardStrategy();
|
||||
virtual ~DrawBillboardStrategy() {} // at 0x8
|
||||
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
|
||||
|
||||
void Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_DRAW_DIRECTIONAL_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_DIRECTIONAL_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawDirectionalStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawDirectionalStrategy();
|
||||
virtual ~DrawDirectionalStrategy() {} // at 0x8
|
||||
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
|
||||
|
||||
void Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef NW4R_EF_DRAW_FREE_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_FREE_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawFreeStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawFreeStrategy();
|
||||
virtual ~DrawFreeStrategy() {} // at 0x8
|
||||
|
||||
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_DRAWINFO
|
||||
#define NW4R_EF_DRAWINFO
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct DrawInfo
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef NW4R_EF_DRAW_LINE_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_LINE_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawLineStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawLineStrategy();
|
||||
virtual ~DrawLineStrategy() {} // at 0x8
|
||||
|
||||
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef NW4R_EF_DRAWORDER
|
||||
#define NW4R_EF_DRAWORDER
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_particlemanager.h"
|
||||
#include "ef_draworderbase.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct DrawOrder : DrawOrderBase
|
||||
{
|
||||
void Draw(Effect *, const DrawInfo &);
|
||||
void Add(Effect *, ParticleManager *);
|
||||
void Remove(Effect *, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef NW4R_EF_DRAWORDERBASE
|
||||
#define NW4R_EF_DRAWORDERBASE
|
||||
#include "ef_particlemanager.h"
|
||||
#include "ut_list.h"
|
||||
#include <common.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace ef {
|
||||
struct DrawOrderBase {
|
||||
virtual void Add(Effect *, ParticleManager *) = 0;
|
||||
virtual void Remove(Effect *, ParticleManager *) = 0;
|
||||
virtual void Draw(Effect *, const DrawInfo &) = 0;
|
||||
};
|
||||
} // namespace ef
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_DRAW_POINT_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_POINT_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawPointStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawPointStrategy();
|
||||
virtual ~DrawPointStrategy() {} // at 0x8
|
||||
|
||||
void Draw(const DrawInfo&, ParticleManager *);
|
||||
void InitGraphics(const DrawInfo&, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_DRAW_SMOOTH_STRIPE_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_SMOOTH_STRIPE_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawSmoothStripeStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawSmoothStripeStrategy();
|
||||
virtual ~DrawSmoothStripeStrategy() {} // at 0x8
|
||||
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
|
||||
|
||||
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef NW4R_EF_DRAWSTRATEGY_H
|
||||
#define NW4R_EF_DRAWSTRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct DrawStrategy
|
||||
{
|
||||
inline virtual ~DrawStrategy() {}
|
||||
virtual UNKTYPE Draw(const DrawInfo &, ParticleManager *) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef NW4R_EF_DRAWSTRATEGYBUILDER_H
|
||||
#define NW4R_EF_DRAWSTRATEGYBUILDER_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
enum DrawStrategyType
|
||||
{
|
||||
DrawStratType_Point,
|
||||
DrawStratType_Line,
|
||||
DrawStratType_Free,
|
||||
DrawStratType_Billboard,
|
||||
DrawStratType_Directional,
|
||||
DrawStratType_Stripe,
|
||||
DrawStratType_SmoothStripe
|
||||
};
|
||||
|
||||
struct DrawStrategyBuilder
|
||||
{
|
||||
virtual DrawStrategy * Create(u32);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef NW4R_EF_DRAW_STRATEGY_IMPL_H
|
||||
#define NW4R_EF_DRAW_STRATEGY_IMPL_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategy.h"
|
||||
#include "math_types.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawStrategyImpl : public DrawStrategy
|
||||
{
|
||||
public:
|
||||
struct PrevTexture
|
||||
{
|
||||
UNKWORD WORD_0x0;
|
||||
f32 FLOAT_0x4;
|
||||
f32 FLOAT_0x8;
|
||||
f32 FLOAT_0xC;
|
||||
f32 FLOAT_0x10;
|
||||
UNKWORD WORD_0x14;
|
||||
UNKWORD WORD_0x18;
|
||||
math::VEC2 VEC2_0x1C;
|
||||
f32 FLOAT_0x24;
|
||||
math::VEC2 VEC2_0x28;
|
||||
};
|
||||
|
||||
public:
|
||||
DrawStrategyImpl();
|
||||
virtual UNKTYPE GetGetFirstDrawParticleFunc(int);
|
||||
virtual UNKTYPE GetGetNextDrawParticleFunc(int);
|
||||
|
||||
void InitTexture(const EmitterDrawSetting &);
|
||||
void InitTev(const EmitterDrawSetting &, const DrawInfo &);
|
||||
void InitColor(ParticleManager *, const EmitterDrawSetting &, const DrawInfo &);
|
||||
|
||||
private:
|
||||
PrevTexture mPrevTextures[3]; // at 0x4
|
||||
char UNK_0x94[0xBC - 0x94];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_DRAW_STRIPE_STRATEGY_H
|
||||
#define NW4R_EF_DRAW_STRIPE_STRATEGY_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_drawstrategyimpl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
class DrawStripeStrategy : public DrawStrategyImpl
|
||||
{
|
||||
public:
|
||||
DrawStripeStrategy();
|
||||
virtual ~DrawStripeStrategy() {} // at 0x8
|
||||
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
|
||||
|
||||
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef NW4R_EF_EFFECT
|
||||
#define NW4R_EF_EFFECT
|
||||
#include "types_nw4r.h"
|
||||
#include "math_types.h"
|
||||
#include "ef_ref.h"
|
||||
#include "ut_list.h"
|
||||
#include "ef_list.h"
|
||||
#include "ef_util.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct Effect : ReferencedObject
|
||||
{
|
||||
EffectSystem * mSystem; // at 0x20
|
||||
ActivityList mEmitters; // at 0x24
|
||||
u32 INDEX_0x40;
|
||||
|
||||
void (* mEmissionPrologue)(Emitter *, ParticleManager *, int *, u32 *, float *, u16 *, float *, math::MTX34 *); // at 0x44
|
||||
|
||||
UNKWORD WORD_0x48;
|
||||
UNKWORD WORD_0x4C;
|
||||
u32 mFlags; // at 0x50
|
||||
math::MTX34 mRootMtx; // at 0x54
|
||||
math::VEC3 VEC_0x84;
|
||||
ut::List UTLIST_0x90;
|
||||
DrawOrder * mDrawOrder; // at 0x9c
|
||||
|
||||
Effect();
|
||||
~Effect();
|
||||
|
||||
virtual bool Initialize(EffectSystem *, EmitterResource *, u16);
|
||||
virtual Emitter * CreateEmitter(ResEmitter, u8, u16);
|
||||
virtual void Calc(bool);
|
||||
virtual void Draw(const DrawInfo &);
|
||||
|
||||
bool SendClosing();
|
||||
UNKTYPE DestroyFunc();
|
||||
bool Closing(Emitter *);
|
||||
Emitter * CreateEmitter(EmitterResource *, u8, u16);
|
||||
bool RetireEmitter(Emitter *);
|
||||
u16 RetireEmitterAll();
|
||||
u16 RetireParticleAll();
|
||||
u16 GetNumEmitter() const;
|
||||
Emitter * GetEmitter(u16);
|
||||
u16 ForeachParticleManager(Action, u32, bool);
|
||||
u16 ForeachEmitterFrom(Action, u32, bool, Emitter *);
|
||||
UNKTYPE SetRootMtx(const math::MTX34 &);
|
||||
|
||||
inline bool GetFlagDisableDraw()
|
||||
{
|
||||
return mFlags & 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef NW4R_EF_EFFECTSYSTEM
|
||||
#define NW4R_EF_EFFECTSYSTEM
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_creationqueue.h"
|
||||
#include "ef_ref.h"
|
||||
#include "ef_rand.h"
|
||||
#include "ef_list.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EffectSystem
|
||||
{
|
||||
static bool mDisplayVersion;
|
||||
|
||||
static EffectSystem instance;
|
||||
|
||||
MemoryManager * mMemoryManager; // at 0x0
|
||||
DrawOrder * mDrawOrder; // at 0x4
|
||||
DrawStrategyBuilder * mDrawStrategyBuilder; // at 0x8
|
||||
EmitFormBuilder * mEmitFormBuilder; // at 0xc
|
||||
CreationQueue mCreationQueue; // at 0x10
|
||||
u32 mNumGroup;
|
||||
ActivityList * ARR_0x5018;
|
||||
Random mRandom; // at 0x501C
|
||||
math::VEC3 VEC_0x5020;
|
||||
math::MTX34 MTX_0x502C;
|
||||
float FLOAT_0x505C;
|
||||
float FLOAT_0x5060;
|
||||
char BYTE_0x5064;
|
||||
|
||||
inline MemoryManager * GetMemoryManager() const
|
||||
{
|
||||
return mMemoryManager;
|
||||
}
|
||||
|
||||
EffectSystem();
|
||||
~EffectSystem();
|
||||
|
||||
static EffectSystem * GetInstance();
|
||||
|
||||
bool Initialize(u32);
|
||||
bool Closing(Effect *);
|
||||
Effect * CreateEffect(const char *, u32, u16);
|
||||
bool RetireEffect(Effect *);
|
||||
u16 RetireEffectAll(u32);
|
||||
u16 RetireEmitterAll(u32);
|
||||
u16 RetireParticleAll(u32);
|
||||
|
||||
void Calc(u32, bool);
|
||||
void Draw(const DrawInfo &, u32);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef NW4R_EF_EMFORM_H
|
||||
#define NW4R_EF_EMFORM_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
enum EmitFormType
|
||||
{
|
||||
EmitForm_Disc,
|
||||
EmitForm_Line,
|
||||
EmitForm_Cube = 5,
|
||||
EmitForm_Cylinder = 7,
|
||||
EmitForm_Sphere,
|
||||
EmitForm_Point,
|
||||
EmitForm_Torus
|
||||
};
|
||||
|
||||
struct EmitFormBuilder
|
||||
{
|
||||
virtual EmitterForm * Create(EmitFormType);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,259 @@
|
||||
#ifndef NW4R_EF_EMITTER
|
||||
#define NW4R_EF_EMITTER
|
||||
#include <math.h>
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_ref.h"
|
||||
#include "ut_list.h"
|
||||
#include "ef_list.h"
|
||||
#include "ef_rand.h"
|
||||
#include "ef_util.h"
|
||||
#include "ef_animcurve.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct ResEmitter
|
||||
{
|
||||
EmitterResource * mPtr;
|
||||
|
||||
inline EmitterResource * ptr() { return mPtr; }
|
||||
};
|
||||
|
||||
struct EmitterInheritSetting
|
||||
{
|
||||
s16 SHORT_0x0;
|
||||
u8 BYTE_0x2;
|
||||
u8 BYTE_0x3;
|
||||
u8 BYTE_0x4;
|
||||
u8 BYTE_0x5;
|
||||
u8 BYTE_0x6;
|
||||
u8 BYTE_0x7;
|
||||
};
|
||||
|
||||
struct EmitterDesc
|
||||
{
|
||||
UNKWORD FLAGS_0x0; // at 0x0/0x8
|
||||
UNKWORD EMFORMTYPE_0x4; // at 0x4/0xc
|
||||
u16 SHORT_0x8; // at 0x8/0x10
|
||||
u16 SHORT_0xA; // at 0xa/0x12
|
||||
s8 SBYTE_0xC; // at 0xc/0x14
|
||||
s8 SBYTE_0xD; // at 0xd/0x15
|
||||
s8 SBYTE_0xE; // at 0xe/0x16
|
||||
s8 SBYTE_0xF; // at 0xf/0x17
|
||||
float FLOAT_0x10; // at 0x10/0x18
|
||||
u16 SHORT_0x14; // at 0x14/0x1c
|
||||
u16 SHORT_0x16; // at 0x16/0x1e
|
||||
u16 SHORT_0x18; // at 0x18/0x20
|
||||
s8 BYTE_0x1A; // at 0x1a/0x22
|
||||
s8 BYTE_0x1B; // at 0x1b/0x23
|
||||
float FLOAT_0x1C;
|
||||
float FLOAT_0x20;
|
||||
float FLOAT_0x24;
|
||||
float FLOAT_0x28;
|
||||
float FLOAT_0x2C;
|
||||
float FLOAT_0x30;
|
||||
u16 SHORT_0x34;
|
||||
u8 BYTE_0x36;
|
||||
u8 BYTE_0x37;
|
||||
float FLOAT_0x38;
|
||||
float FLOAT_0x3C;
|
||||
float FLOAT_0x40;
|
||||
float FLOAT_0x44;
|
||||
float FLOAT_0x48;
|
||||
float FLOAT_0x4C;
|
||||
float FLOAT_0x50;
|
||||
float FLOAT_0x54;
|
||||
float FLOAT_0x58;
|
||||
float FLOAT_0x5C;
|
||||
|
||||
float FLOAT_0x60;
|
||||
float FLOAT_0x64;
|
||||
float FLOAT_0x68;
|
||||
float FLOAT_0x6C;
|
||||
float FLOAT_0x70;
|
||||
float FLOAT_0x74;
|
||||
|
||||
float FLOAT_0x78;
|
||||
float FLOAT_0x7C;
|
||||
float FLOAT_0x80;
|
||||
|
||||
u8 BYTE_0x84; // at 0x84/0x8c
|
||||
u8 BYTE_0x85; // at 0x85/0x8d
|
||||
u8 BYTE_0x86; // at 0x86/0x8e
|
||||
UNKWORD WORD_0x88;
|
||||
};
|
||||
|
||||
struct EmitTrack
|
||||
{
|
||||
u8 BYTE_0x0;
|
||||
u8 BYTE_0x1;
|
||||
u16 SHORT_0x2;
|
||||
|
||||
u8 BYTE_0x4;
|
||||
};
|
||||
|
||||
struct EmitterResource
|
||||
{
|
||||
char UNK_0x0[0x4];
|
||||
u32 OFFSET_0x4;
|
||||
|
||||
EmitterDesc STRUCT_0x8;
|
||||
|
||||
inline UNKTYPE * SkipEmitterDesc()
|
||||
{
|
||||
return (char *)&STRUCT_0x8 + OFFSET_0x4;
|
||||
}
|
||||
|
||||
inline UNKTYPE * SkipParticleParameterDesc()
|
||||
{
|
||||
char * particleDesc = (char *)SkipEmitterDesc();
|
||||
|
||||
return particleDesc + *(int *)particleDesc;
|
||||
}
|
||||
|
||||
inline u16 NumEmitInitTrack()
|
||||
{
|
||||
u16 * ptr = (u16 *)SkipParticleParameterDesc();
|
||||
|
||||
return ptr[(4**(ptr += 2))+3];
|
||||
}
|
||||
|
||||
inline u16 NumEmitTrack()
|
||||
{
|
||||
u16 * ptr = (u16 *)SkipParticleParameterDesc();
|
||||
|
||||
return ptr[(4**(ptr += 2))+2];
|
||||
}
|
||||
|
||||
inline EmitTrack * GetEmitTrack(u16 i)
|
||||
{
|
||||
u16 * ptr = (u16 *)SkipParticleParameterDesc();
|
||||
|
||||
return reinterpret_cast<EmitTrack **>(ptr)[(2**(ptr += 1))+1+i];
|
||||
}
|
||||
};
|
||||
|
||||
struct Emitter : ReferencedObject
|
||||
{
|
||||
virtual bool Initialize(Effect *, EmitterResource *, u8); // at 0x10
|
||||
virtual Emitter * CreateEmitter(EmitterResource *, EmitterInheritSetting *, Particle *, u16); // at 0x14
|
||||
virtual void CalcEmitter(); // at 0x18
|
||||
virtual void CalcParticle(); // at 0x1c
|
||||
virtual void CalcEmission(); // at 0x20
|
||||
virtual void CalcBillboard(); // at 0x24
|
||||
|
||||
u32 mFlags;
|
||||
UNKWORD WORD_0x24;
|
||||
|
||||
//char UNK_0x28[0x8C];
|
||||
float FLOAT_0x28;
|
||||
float FLOAT_0x2C;
|
||||
short SHORT_0x30;
|
||||
short SHORT_0x32;
|
||||
float FLOAT_0x34;
|
||||
float FLOAT_0x38;
|
||||
short SHORT_0x3C;
|
||||
float FLOAT_0x40;
|
||||
float FLOAT_0x44;
|
||||
float FLOAT_0x48;
|
||||
float FLOAT_0x4C;
|
||||
float FLOAT_0x50;
|
||||
float FLOAT_0x54;
|
||||
float FLOAT_0x58;
|
||||
float FLOAT_0x5C;
|
||||
float FLOAT_0x60;
|
||||
|
||||
u8 BYTE_0x64;
|
||||
s8 BYTE_0x65;
|
||||
u8 BYTE_0x66;
|
||||
s8 BYTE_0x67;
|
||||
|
||||
float FLOAT_0x68;
|
||||
float FLOAT_0x6C;
|
||||
float FLOAT_0x70;
|
||||
float FLOAT_0x74;
|
||||
float FLOAT_0x78;
|
||||
float FLOAT_0x7C;
|
||||
float FLOAT_0x80;
|
||||
float FLOAT_0x84;
|
||||
float FLOAT_0x88;
|
||||
float FLOAT_0x8C;
|
||||
/*
|
||||
float FLOAT_0x90;
|
||||
float FLOAT_0x94;
|
||||
float FLOAT_0x98;
|
||||
*/
|
||||
math::VEC3 VEC_0x90;
|
||||
/*
|
||||
float FLOAT_0x9C;
|
||||
float FLOAT_0xA0;
|
||||
float FLOAT_0xA4;
|
||||
*/
|
||||
math::VEC3 VEC_0x9C;
|
||||
/*
|
||||
float FLOAT_0xA8;
|
||||
float FLOAT_0xAC;
|
||||
float FLOAT_0xB0;
|
||||
*/
|
||||
math::VEC3 VEC_0xA8;
|
||||
|
||||
UNKWORD WORD_0xB4;
|
||||
EmitterResource * mResource; // at 0xb8
|
||||
Effect * mEffect; // at 0xbc
|
||||
ActivityList mManagers; // at 0xc0
|
||||
char UNK_0xDA[0x2];
|
||||
u8 BYTE_0xDC;
|
||||
u16 SHORT_0xDE;
|
||||
u16 SHORT_0xE0;
|
||||
UNKWORD WORD_0xE4;
|
||||
u16 SHORT_0xE8;
|
||||
u16 SHORT_0xEA;
|
||||
Random mRandom; // at 0xec
|
||||
EmitterForm * mForm; // at 0xf0
|
||||
Emitter * mParent; // at 0xf4
|
||||
Particle * REF_0xF8; // at 0xf8
|
||||
|
||||
EmitterInheritSetting mInheritSettings; // at 0xfc
|
||||
|
||||
bool mMtxDirtyFlag; // at 0x104
|
||||
|
||||
math::MTX34 mGlobalMtx; // at 0x108
|
||||
|
||||
Emitter();
|
||||
~Emitter();
|
||||
|
||||
u16 RetireParticleAll();
|
||||
bool SendClosing();
|
||||
void DestroyFunc();
|
||||
bool Closing(ParticleManager *);
|
||||
bool RetireParticleManager(ParticleManager *);
|
||||
u16 RetireParticleManagerAll();
|
||||
bool InitializeDatas(EmitterResource *, Effect *);
|
||||
|
||||
ParticleManager * FindParticleManager(EmitterResource *, bool, bool, s8, u8);
|
||||
UNKTYPE CreateEmitterTmp(EmitterResource *, EmitterInheritSetting *, Particle *, u16);
|
||||
|
||||
float GetLODratio(math::VEC3 &, math::VEC3 &, float, float, float, float);
|
||||
|
||||
u16 ForeachParticleManager(Action, u32, bool, bool);
|
||||
|
||||
UNKTYPE Emission(ParticleManager *, const math::MTX34 *);
|
||||
|
||||
math::MTX34 * CalcGlobalMtx(math::MTX34 *);
|
||||
UNKTYPE SetMtxDirty();
|
||||
|
||||
static math::MTX34 * RestructMatrix(math::MTX34 *, math::MTX34 *, bool, bool, s8);
|
||||
|
||||
u16 GetNumParticleManager() const;
|
||||
ParticleManager * GetParticleManager(u16);
|
||||
|
||||
inline bool GetFlagDisableCalc() const
|
||||
{
|
||||
return mFlags & 0x200;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef NW4R_EF_EMITTERFORM_H
|
||||
#define NW4R_EF_EMITTERFORM_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *) = 0;
|
||||
|
||||
UNKTYPE CalcVelocity(math::VEC3 *, Emitter *, const math::VEC3 &, const math::VEC3 &, const math::VEC3 &, const math::VEC3 &) const;
|
||||
u16 CalcLife(u16, float, Emitter *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef NW4R_EF_HANDLE_H
|
||||
#define NW4R_EF_HANDLE_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct LinkedObject
|
||||
{
|
||||
char UNK_0x0[8];
|
||||
LinkedObject * PTR_0x8;
|
||||
};
|
||||
|
||||
struct HandleBase
|
||||
{
|
||||
LinkedObject * PTR_0x0;
|
||||
LinkedObject * mPtr;
|
||||
|
||||
HandleBase();
|
||||
HandleBase & operator=(const HandleBase &);
|
||||
HandleBase & operator=(LinkedObject *);
|
||||
bool IsValid() const;
|
||||
LinkedObject * GetPtr() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_LINE_H
|
||||
#define NW4R_EF_LINE_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormLine : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef NW4R_EF_LIST
|
||||
#define NW4R_EF_LIST
|
||||
#include "types_nw4r.h"
|
||||
#include "ut_list.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
//sizeof(ActivityList) = 0x1C
|
||||
struct ActivityList
|
||||
{
|
||||
ut::List mActive;
|
||||
ut::List mClosing;
|
||||
u16 mNumActive;
|
||||
|
||||
inline void SetOffset(u16 offset)
|
||||
{
|
||||
ut::List_Init(&mActive, offset);
|
||||
ut::List_Init(&mClosing, offset);
|
||||
mNumActive = 0;
|
||||
}
|
||||
|
||||
inline ActivityList(u16 offset)
|
||||
{
|
||||
SetOffset(offset);
|
||||
}
|
||||
|
||||
inline ActivityList()
|
||||
{
|
||||
SetOffset(0);
|
||||
}
|
||||
|
||||
inline void Initialize()
|
||||
{
|
||||
mActive.first = NULL;
|
||||
mActive.size = 0;
|
||||
mActive.last = NULL;
|
||||
|
||||
mClosing.first = NULL;
|
||||
mClosing.size = 0;
|
||||
mClosing.last = NULL;
|
||||
|
||||
mNumActive = 0;
|
||||
}
|
||||
|
||||
inline void ToActive(void * pNode)
|
||||
{
|
||||
ut::List_Append(&mActive, pNode);
|
||||
mNumActive++;
|
||||
}
|
||||
|
||||
inline void ToClosing(void * pNode)
|
||||
{
|
||||
ut::List_Remove(&mActive, pNode);
|
||||
ut::List_Append(&mClosing, pNode);
|
||||
}
|
||||
|
||||
inline void ToWait(void * pNode)
|
||||
{
|
||||
mNumActive--;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_MEMORYMANAGER
|
||||
#define NW4R_EF_MEMORYMANAGER
|
||||
#include "ef_memorymanagerbase.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct MemoryManager : MemoryManagerBase
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef NW4R_EF_MEMORYMANAGERBASE
|
||||
#define NW4R_EF_MEMORYMANAGERBASE
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct MemoryManagerBase
|
||||
{
|
||||
virtual ~MemoryManagerBase(); // at 0x8
|
||||
virtual UNKTYPE GarbageCollection() = 0; // at 0xc
|
||||
|
||||
virtual Effect * AllocEffect() = 0; // at 0x10
|
||||
virtual UNKTYPE FreeEffect(void *) = 0; // at 0x14
|
||||
virtual UNKWORD GetNumAllocEffect() const = 0; // at 0x18
|
||||
virtual UNKWORD GetNumActiveEffect() const = 0; // at 0x1c
|
||||
virtual UNKWORD GetNumFreeEffect() const = 0; // at 0x20
|
||||
|
||||
virtual Emitter * AllocEmitter() = 0; // at 0x24
|
||||
virtual UNKTYPE FreeEmitter(void *) = 0; // at 0x28
|
||||
virtual UNKWORD GetNumAllocEmitter() const = 0; // at 0x2c
|
||||
virtual UNKWORD GetNumActiveEmitter() const = 0; // at 0x30
|
||||
virtual UNKWORD GetNumFreeEmitter() const = 0; // at 0x34
|
||||
|
||||
virtual ParticleManager * AllocParticleManager() = 0; // at 0x38
|
||||
virtual UNKTYPE FreeParticleManager(void *) = 0; // at 0x3c
|
||||
virtual UNKWORD GetNumAllocParticleManager() const = 0; // at 0x40
|
||||
virtual UNKWORD GetNumActiveParticleManager() const = 0; // at 0x44
|
||||
virtual UNKWORD GetNumFreeParticleManager() const = 0; // at 0x48
|
||||
|
||||
virtual Particle * AllocParticle() = 0; // at 0x4c
|
||||
virtual UNKTYPE FreeParticle(void *) = 0; // at 0x50
|
||||
virtual UNKWORD GetNumAllocParticle() const = 0; // at 0x54
|
||||
virtual UNKWORD GetNumActiveParticle() const = 0; // at 0x58
|
||||
virtual UNKWORD GetNumFreeParticle() const = 0; // at 0x5c
|
||||
|
||||
virtual void * AllocHeap(u32) = 0; // at 0x60
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef NW4R_EF_PARTICLE_H
|
||||
#define NW4R_EF_PARTICLE_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ef_ref.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct Particle : ReferencedObject
|
||||
{
|
||||
char UNK_0x20[0x8C];
|
||||
|
||||
math::VEC3 VEC_0xAC;
|
||||
math::VEC3 VEC_0xB8;
|
||||
|
||||
char UNK_0xC4[0x4];
|
||||
|
||||
ParticleManager * mManager; // at 0xc8
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef NW4R_EF_PARTICLEMANAGER
|
||||
#define NW4R_EF_PARTICLEMANAGER
|
||||
#include "types_nw4r.h"
|
||||
#include "math_types.h"
|
||||
#include "ef_list.h"
|
||||
#include "ef_ref.h"
|
||||
#include "ut_Color.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct ParticleManager : ReferencedObject
|
||||
{
|
||||
struct ParticleModifier
|
||||
{
|
||||
math::VEC2 mScale; // at 0x0
|
||||
math::VEC3 mRotate; // at 0x8
|
||||
|
||||
struct SimpleLight
|
||||
{
|
||||
u8 mType; // at 0x0
|
||||
ut::Color mAmbColor; // at 0x1
|
||||
} mLight;
|
||||
};
|
||||
|
||||
UNKTYPE BeginDraw();
|
||||
UNKTYPE EndDraw();
|
||||
UNKTYPE BeginCalc(bool);
|
||||
UNKTYPE EndCalc();
|
||||
|
||||
bool SendClosing();
|
||||
UNKTYPE DestroyFunc();
|
||||
virtual bool Initialize(Emitter *, EmitterResource *);
|
||||
virtual UNKTYPE CreateParticle(u16, math::VEC3, math::VEC3, const math::MTX34 *, float, const EmitterInheritSetting *, Particle *, u16);
|
||||
virtual UNKTYPE Calc();
|
||||
virtual UNKTYPE Draw(const DrawInfo &);
|
||||
|
||||
Emitter * mEmitter; // at 0x20
|
||||
EmitterResource * mResource; // at 0x24
|
||||
UNKWORD FLAGS_0x28;
|
||||
char UNK_0x2C[0xC];
|
||||
ActivityList EFLIST_0x38;
|
||||
char UNK_0x54[0x4];
|
||||
|
||||
ParticleModifier mMod; // at 0x58
|
||||
|
||||
char UNK_0x74[0x14];
|
||||
|
||||
s8 BYTE_0x88;
|
||||
u8 BYTE_0x89;
|
||||
bool BOOL_0x8A;
|
||||
|
||||
UNKWORD FLAGS_0xB4;
|
||||
|
||||
u16 RetireParticleAll();
|
||||
|
||||
UNKTYPE CalcGlobalMtx(math::MTX34 *);
|
||||
|
||||
static void ModifierTravFunc_SetSimpleLightType(void *p, u32 payload)
|
||||
{
|
||||
ParticleManager *mgr = (ParticleManager *)p;
|
||||
u8 type = (u8)payload;
|
||||
mgr->mMod.mLight.mType = type;
|
||||
}
|
||||
|
||||
static void ModifierTravFunc_SetSimpleLightAmbient(void *p, u32 payload)
|
||||
{
|
||||
ParticleManager *mgr = (ParticleManager *)p;
|
||||
ut::Color *color = (ut::Color *)payload;
|
||||
mgr->mMod.mLight.mAmbColor = *color;
|
||||
}
|
||||
|
||||
static void ModifierTravFunc_SetScale(void *p, u32 payload)
|
||||
{
|
||||
ParticleManager *mgr = (ParticleManager *)p;
|
||||
math::VEC2 *scale = (math::VEC2 *)payload;
|
||||
mgr->mMod.mScale = *scale;
|
||||
}
|
||||
|
||||
static void ModifierTravFunc_SetRotate(void *p, u32 payload)
|
||||
{
|
||||
ParticleManager *mgr = (ParticleManager *)p;
|
||||
math::VEC3 *rot = (math::VEC3 *)payload;
|
||||
mgr->mMod.mRotate = *rot;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_POINT_H
|
||||
#define NW4R_EF_POINT_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormPoint : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef NW4R_EF_RAND_H
|
||||
#define NW4R_EF_RAND_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct Random
|
||||
{
|
||||
u32 mSeed; // at 0x0
|
||||
|
||||
inline u32 MixRandomSeed()
|
||||
{
|
||||
return mSeed = mSeed * 0x343fd + 0x269ec3;
|
||||
}
|
||||
|
||||
inline void Srand(u32 seed)
|
||||
{
|
||||
mSeed = seed;
|
||||
}
|
||||
|
||||
inline u32 Rand()
|
||||
{
|
||||
//WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
|
||||
return MixRandomSeed() >> 0x10;
|
||||
}
|
||||
|
||||
inline float RandFloat()
|
||||
{
|
||||
//WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
|
||||
return (float)Rand() / 0xFFFF;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef NW4R_EF_REF
|
||||
#define NW4R_EF_REF
|
||||
#include "types_nw4r.h"
|
||||
#include "math_types.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct ReferencedObject
|
||||
{
|
||||
char UNK_0x0[0xC];
|
||||
UNKWORD WORD_0xC;
|
||||
u32 mRefCount; // at 0x10
|
||||
char UNK_0x14[0x8];
|
||||
|
||||
virtual bool SendClosing();
|
||||
virtual UNKTYPE DestroyFunc();
|
||||
|
||||
inline void Initialize()
|
||||
{
|
||||
mRefCount = 0;
|
||||
WORD_0xC = 1;
|
||||
}
|
||||
|
||||
inline void Ref()
|
||||
{
|
||||
mRefCount++;
|
||||
}
|
||||
|
||||
inline void UnRef()
|
||||
{
|
||||
if (--mRefCount == 0 && WORD_0xC == 2) SendClosing();
|
||||
}
|
||||
|
||||
inline void Destroy()
|
||||
{
|
||||
DestroyFunc();
|
||||
WORD_0xC = 2;
|
||||
if (mRefCount == 0) SendClosing();
|
||||
}
|
||||
};
|
||||
|
||||
typedef ReferencedObject UNKREF;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef NW4R_EF_RESOURCE
|
||||
#define NW4R_EF_RESOURCE
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct Resource
|
||||
{
|
||||
EmitterResource * _FindEmitter(const char *, EffectProject *) const;
|
||||
|
||||
static Resource * GetInstance();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_SPHERE_H
|
||||
#define NW4R_EF_SPHERE_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormSphere : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef NW4R_EF_TORUS_H
|
||||
#define NW4R_EF_TORUS_H
|
||||
#include "ef_emitterform.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
struct EmitterFormTorus : EmitterForm
|
||||
{
|
||||
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef NW4R_EF_UTIL
|
||||
#define NW4R_EF_UTIL
|
||||
#include "types_nw4r.h"
|
||||
#include "ut_list.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace ef
|
||||
{
|
||||
typedef void (* Action)(void *, u32);
|
||||
|
||||
u16 UtlistToArray(const ut::List *, void **, int);
|
||||
|
||||
UNKTYPE GetDirMtxY(math::MTX34 *, const math::VEC3 &);
|
||||
UNKTYPE MtxGetRotation(const math::MTX34 &, math::VEC3 *);
|
||||
UNKTYPE MtxGetTranslate(const math::MTX34 &, math::VEC3 *);
|
||||
UNKTYPE MtxGetRotationMtx(const math::MTX34 &, math::MTX34 *);
|
||||
UNKTYPE MtxGetScale(const math::MTX34 &, math::VEC3 *);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef NW4R_G3D_3DSMAX_H
|
||||
#define NW4R_G3D_3DSMAX_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_anmtexsrt.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace dcc
|
||||
{
|
||||
bool CalcTexMtx_3dsmax(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef NW4R_G3D_ANMCAMERA_H
|
||||
#define NW4R_G3D_ANMCAMERA_H
|
||||
#include "math_types.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct CameraAnmResult {
|
||||
UNKWORD WORD_0x0;
|
||||
GXProjectionType projType;
|
||||
f32 FLOAT_0x8;
|
||||
f32 FLOAT_0xC;
|
||||
f32 FLOAT_0x10;
|
||||
f32 FLOAT_0x14;
|
||||
f32 FLOAT_0x18;
|
||||
f32 FLOAT_0x1C;
|
||||
f32 FLOAT_0x20;
|
||||
f32 FLOAT_0x24;
|
||||
f32 FLOAT_0x28;
|
||||
f32 FLOAT_0x2C;
|
||||
f32 FLOAT_0x30;
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef NW4R_G3D_ANMCHR_H
|
||||
#define NW4R_G3D_ANMCHR_H
|
||||
#include "types_nw4r.h"
|
||||
#include "math_types.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ChrAnmResult
|
||||
{
|
||||
u32 mFlags; // at 0x0
|
||||
math::VEC3 VEC3_0x4;
|
||||
math::VEC3 VEC3_0x10;
|
||||
math::MTX34 mMtx; // at 0x1C
|
||||
};
|
||||
|
||||
struct AnmObjChr
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct AnmObjChrNode
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct AnmObjChrBlend
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct AnmObjChrRes
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef NW4R_G3D_ANMCLR_H
|
||||
#define NW4R_G3D_ANMCLR_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ClrAnmResult
|
||||
{
|
||||
enum
|
||||
{
|
||||
ANM_COUNT = 11
|
||||
};
|
||||
|
||||
u32 mFlags; // at 0x0
|
||||
u32 COLORS_0x4[ANM_COUNT];
|
||||
UNKWORD WORDS_0x30[ANM_COUNT];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef NW4R_G3D_ANMFOG_H
|
||||
#define NW4R_G3D_ANMFOG_H
|
||||
#include "types_nw4r.h"
|
||||
#include "ut_Color.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct FogAnmResult {
|
||||
GXFogType mFogType; // at 0x18
|
||||
f32 mStartZ; // at 0x14
|
||||
f32 mEndZ; // at 0x10
|
||||
ut::Color mColor; // at 0xC
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,129 @@
|
||||
#ifndef NW4R_G3D_ANMOBJ_H
|
||||
#define NW4R_G3D_ANMOBJ_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_resmdl.h"
|
||||
#include "g3d_obj.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
enum AnmPolicy
|
||||
{
|
||||
ANM_POLICY_ONETIME,
|
||||
ANM_POLICY_LOOP,
|
||||
ANM_POLICY_MAX
|
||||
};
|
||||
|
||||
typedef f32 (* PlayPolicyFunc)(f32, f32, f32);
|
||||
f32 PlayPolicy_Onetime(f32, f32, f32);
|
||||
f32 PlayPolicy_Loop(f32, f32, f32);
|
||||
|
||||
inline PlayPolicyFunc GetAnmPlayPolicy(AnmPolicy policy)
|
||||
{
|
||||
static PlayPolicyFunc policyTable[ANM_POLICY_MAX] = {
|
||||
PlayPolicy_Onetime,
|
||||
PlayPolicy_Loop
|
||||
};
|
||||
return policyTable[policy];
|
||||
}
|
||||
|
||||
struct FrameCtrl
|
||||
{
|
||||
FrameCtrl(f32 f1, f32 f2, PlayPolicyFunc policy)
|
||||
: mFrame(0.0f), mRate(1.0f), FLOAT_0x8(f1), mEndFrame(f2), mPolicy(policy) {}
|
||||
|
||||
f32 GetFrm() const
|
||||
{
|
||||
return mFrame;
|
||||
}
|
||||
|
||||
f32 GetRate() const
|
||||
{
|
||||
return mRate;
|
||||
}
|
||||
|
||||
void SetFrm(f32 frm)
|
||||
{
|
||||
f32 newFrm = mPolicy(FLOAT_0x8, mEndFrame, frm);
|
||||
mFrame = newFrm;
|
||||
}
|
||||
|
||||
void SetRate(f32 rate)
|
||||
{
|
||||
mRate = rate;
|
||||
}
|
||||
|
||||
void SetPolicy(PlayPolicyFunc func)
|
||||
{
|
||||
mPolicy = func;
|
||||
}
|
||||
|
||||
void UpdateFrm()
|
||||
{
|
||||
SetFrm(mFrame + mRate * smBaseUpdateRate);
|
||||
}
|
||||
|
||||
f32 mFrame; // at 0x0
|
||||
f32 mRate; // at 0x4
|
||||
f32 FLOAT_0x8;
|
||||
f32 mEndFrame;
|
||||
PlayPolicyFunc mPolicy; // at 0x10
|
||||
|
||||
static f32 smBaseUpdateRate;
|
||||
};
|
||||
|
||||
class AnmObj : public G3dObj
|
||||
{
|
||||
public:
|
||||
enum AnmFlag
|
||||
{
|
||||
ANMFLAG_2 = 0x2,
|
||||
ANMFLAG_ISBOUND = 0x4
|
||||
};
|
||||
|
||||
public:
|
||||
AnmObj(MEMAllocator *pAllocator, G3dObj *pParent)
|
||||
: G3dObj(pAllocator, pParent), mFlags(0) {}
|
||||
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return (other == GetTypeObjStatic()) ? true
|
||||
: G3dObj::IsDerivedFrom(other);
|
||||
}
|
||||
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
|
||||
virtual ~AnmObj() {} // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char * GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
virtual void SetFrame(f32) = 0; // at 0x1C
|
||||
virtual f32 GetFrame() const = 0; // at 0x20
|
||||
virtual void UpdateFrame() = 0; // at 0x24
|
||||
virtual void SetUpdateRate(f32) = 0; // at 0x28
|
||||
virtual f32 GetUpdateRate() const = 0; // at 0x2C
|
||||
virtual bool Bind(ResMdl) = 0; // at 0x30
|
||||
virtual void Release(); // at 0x34
|
||||
|
||||
static const TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
void SetAnmFlag(AnmFlag, bool);
|
||||
bool TestAnmFlag(AnmFlag) const;
|
||||
|
||||
private:
|
||||
u32 mFlags; // at 0x4
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(AnmObj);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef NW4R_G3D_ANMSCN_H
|
||||
#define NW4R_G3D_ANMSCN_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_obj.h"
|
||||
#include "g3d_light.h"
|
||||
#include "g3d_fog.h"
|
||||
#include "g3d_camera.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
class AnmScnRes // : public AnmScn
|
||||
{
|
||||
};
|
||||
|
||||
class AnmScn : G3dObj
|
||||
{
|
||||
public:
|
||||
AnmScn(MEMAllocator *);
|
||||
virtual bool IsDerivedFrom(TypeObj other) const; // at 0x8
|
||||
virtual ~AnmScn(); // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const; // at 0x14
|
||||
virtual const char * GetTypeName() const; // at 0x18
|
||||
virtual void SetFrame(f32) = 0; // at 0x1C
|
||||
virtual f32 GetFrame() const = 0; // at 0x20
|
||||
virtual void SetUpdateRate(f32) = 0; // at 0x24
|
||||
virtual f32 GetUpdateRate() const = 0; // at 0x28
|
||||
virtual void UpdateFrame() = 0; // at 0x2C
|
||||
virtual void Attach(int, AnmScnRes); // at 0x30
|
||||
virtual void Detach(); // at 0x34
|
||||
virtual int GetNumLightSet() const = 0; // at 0x38
|
||||
virtual int GetNumAmbLight() const = 0; // at 0x3C
|
||||
virtual int GetNumDiffuseLight() const = 0; // at 0x40
|
||||
virtual int GetNumSpecularLight() const = 0; // at 0x44
|
||||
virtual int GetNumFog() const = 0; // at 0x48
|
||||
virtual int GetNumCamera() const = 0; // at 0x4C
|
||||
virtual int GetLightSetMaxRefNumber() const = 0; // at 0x50
|
||||
virtual int GetAmbLightMaxRefNumber() const = 0; // at 0x54
|
||||
virtual int GetDiffuseLightMaxRefNumber() const = 0; // at 0x58
|
||||
virtual int GetFogMaxRefNumber() const = 0; // at 0x5C
|
||||
virtual int GetCameraMaxRefNumber() const = 0; // at 0x60
|
||||
virtual void GetLightSet(LightSet, u32) = 0; // at 0x64
|
||||
virtual ut::Color GetAmbLightColor(u32) = 0; // at 0x68
|
||||
virtual void GetLight(LightObj *, LightObj *, u32) = 0; // at 0x6C
|
||||
virtual void GetFog(Fog, u32) = 0; // at 0x70
|
||||
virtual void GetCamera(Camera, u32) = 0; // at 0x74
|
||||
virtual int GetSpecularLightID(u32) const = 0; // at 0x78
|
||||
virtual bool HasSpecularLight(u32) const = 0; // at 0x7C
|
||||
virtual void GetAmbLightResult(AmbLightAnmResult *, u32) = 0; // at 0x80
|
||||
virtual void GetLightResult(LightAnmResult *, u32) = 0; // at 0x84
|
||||
virtual void GetFogResult(FogAnmResult *, u32) = 0; // at 0x88
|
||||
virtual void GetFogResult(CameraAnmResult *, u32) = 0; // at 0x8C
|
||||
|
||||
void GetLightSetting(LightSetting *);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef NW4R_G3D_ANMTEXPAT_H
|
||||
#define NW4R_G3D_ANMTEXPAT_H
|
||||
#include "g3d_restex.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct TexPatAnmResult
|
||||
{
|
||||
enum
|
||||
{
|
||||
ANM_COUNT = 8
|
||||
};
|
||||
|
||||
u8 mTexFlags; // at 0x0
|
||||
u8 mPlttFlags; // at 0x1
|
||||
ResTex mTexs[ANM_COUNT]; // at 0x4
|
||||
ResPltt mPltts[ANM_COUNT]; // at 0x24
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef NW4R_G3D_ANMTEXSRT_H
|
||||
#define NW4R_G3D_ANMTEXSRT_H
|
||||
#include "g3d_restex.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct TexSrtTypedef
|
||||
{
|
||||
enum TexMatrixMode
|
||||
{
|
||||
TEX_MTX_MAYA,
|
||||
TEX_MTX_XSI,
|
||||
TEX_MTX_3DSMAX
|
||||
};
|
||||
};
|
||||
|
||||
struct TexSrt
|
||||
{
|
||||
enum Flag
|
||||
{
|
||||
FLAG_ANM_EXISTS,
|
||||
};
|
||||
|
||||
float mScaleX; // at 0x0
|
||||
float mScaleY; // at 0x4
|
||||
float mRotation; // at 0x8
|
||||
float mTranslationX; // at 0xc
|
||||
float mTranslationY; // at 0x10
|
||||
};
|
||||
|
||||
struct TexSrtAnmResult
|
||||
{
|
||||
enum
|
||||
{
|
||||
ANM_COUNT = 8
|
||||
};
|
||||
|
||||
UNKWORD FLAGS_0x0;
|
||||
UNKWORD FLAGS_0x4;
|
||||
TexSrt mSrts[ANM_COUNT * 2]; // at 0x8
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,188 @@
|
||||
#ifndef NW4R_G3D_ANMVIS_H
|
||||
#define NW4R_G3D_ANMVIS_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_anmobj.h"
|
||||
#include "g3d_resanmvis.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
void ApplyVisAnmResult(ResMdl, AnmObjVis *);
|
||||
void ApplyVisAnmResult(u8 *, ResMdl, AnmObjVis *);
|
||||
|
||||
class AnmObjVis : public AnmObj
|
||||
{
|
||||
public:
|
||||
AnmObjVis(MEMAllocator *, u16 *, int);
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return (other == GetTypeObjStatic()) ? true
|
||||
: AnmObj::IsDerivedFrom(other);
|
||||
}
|
||||
virtual void G3dProc(u32, u32, void *); // at 0xC
|
||||
virtual ~AnmObjVis() {} // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char * GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
virtual void SetFrame(f32) = 0; // at 0x1C
|
||||
virtual f32 GetFrame() const = 0; // at 0x20
|
||||
virtual void UpdateFrame() = 0; // at 0x24
|
||||
virtual void SetUpdateRate(f32) = 0; // at 0x28
|
||||
virtual f32 GetUpdateRate() const = 0; // at 0x2C
|
||||
virtual bool Bind(ResMdl) = 0; // at 0x30
|
||||
virtual void Release(); // at 0x34
|
||||
virtual bool GetResult(u32) = 0; // at 0x38
|
||||
virtual AnmObjVisRes * Attach(int, AnmObjVisRes *); // at 0x3C
|
||||
virtual AnmObjVisRes * Detach(int); // at 0x40
|
||||
|
||||
static const TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
bool TestDefined(u32 idx) const;
|
||||
bool TestExistence(u32 idx) const;
|
||||
void DetachAll();
|
||||
|
||||
protected:
|
||||
static const int MAX_RESOURCES = 4;
|
||||
|
||||
int mNumBinds; // at 0x10
|
||||
u16 *mBinds; // at 0x14
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVis);
|
||||
};
|
||||
|
||||
class AnmObjVisNode : public AnmObjVis
|
||||
{
|
||||
public:
|
||||
AnmObjVisNode(MEMAllocator *allocator, u16 *bindBuffer, int numBinds)
|
||||
: AnmObjVis(allocator, bindBuffer, numBinds)
|
||||
{
|
||||
mResources[0] = NULL;
|
||||
mResources[1] = NULL;
|
||||
mResources[2] = NULL;
|
||||
mResources[3] = NULL;
|
||||
}
|
||||
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return (other == GetTypeObjStatic()) ? true
|
||||
: AnmObjVis::IsDerivedFrom(other);
|
||||
}
|
||||
virtual void G3dProc(u32, u32, void *); // at 0xC
|
||||
virtual ~AnmObjVisNode(); // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char * GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
virtual void SetFrame(f32); // at 0x1C
|
||||
virtual f32 GetFrame() const; // at 0x20
|
||||
virtual void UpdateFrame(); // at 0x24
|
||||
virtual void SetUpdateRate(f32); // at 0x28
|
||||
virtual f32 GetUpdateRate() const; // at 0x2C
|
||||
virtual bool Bind(ResMdl); // at 0x30
|
||||
virtual void Release(); // at 0x34
|
||||
virtual bool GetResult(u32) = 0; // at 0x38
|
||||
virtual AnmObjVisRes * Attach(int, AnmObjVisRes *); // at 0x3C
|
||||
virtual AnmObjVisRes * Detach(int); // at 0x40
|
||||
|
||||
static const TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
protected:
|
||||
AnmObjVisRes *mResources[MAX_RESOURCES]; // at 0x18
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisNode);
|
||||
};
|
||||
|
||||
class AnmObjVisOR : public AnmObjVisNode
|
||||
{
|
||||
public:
|
||||
AnmObjVisOR(MEMAllocator *allocator, u16 *bindBuffer, int numBinds)
|
||||
: AnmObjVisNode(allocator, bindBuffer, numBinds)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return (other == GetTypeObjStatic()) ? true
|
||||
: AnmObjVisNode::IsDerivedFrom(other);
|
||||
}
|
||||
virtual ~AnmObjVisOR() {} // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char * GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
virtual bool GetResult(u32); // at 0x38
|
||||
|
||||
static const TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
static AnmObjVisOR * Construct(MEMAllocator *, u32 *, ResMdl);
|
||||
|
||||
private:
|
||||
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisOR);
|
||||
};
|
||||
|
||||
class AnmObjVisRes : public AnmObjVis, public FrameCtrl
|
||||
{
|
||||
public:
|
||||
AnmObjVisRes(MEMAllocator *, ResAnmVis, u16 *, int);
|
||||
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return (other == GetTypeObjStatic()) ? true
|
||||
: AnmObjVis::IsDerivedFrom(other);
|
||||
}
|
||||
virtual ~AnmObjVisRes() {} // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char * GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
virtual void SetFrame(f32); // at 0x1C
|
||||
virtual f32 GetFrame() const; // at 0x20
|
||||
virtual void UpdateFrame(); // at 0x24
|
||||
virtual void SetUpdateRate(f32); // at 0x28
|
||||
virtual f32 GetUpdateRate() const; // at 0x2C
|
||||
virtual bool Bind(ResMdl); // at 0x30
|
||||
virtual bool GetResult(u32); // at 0x38
|
||||
|
||||
static const TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
static AnmObjVisRes * Construct(MEMAllocator *, u32 *, ResAnmVis, ResMdl);
|
||||
|
||||
private:
|
||||
ResAnmVis mResAnmVis; // at 0x2C
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisRes);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef NW4R_G3D_BASIC_H
|
||||
#define NW4R_G3D_BASIC_H
|
||||
#include "math_types.h"
|
||||
#include "g3d_anmchr.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace WorldMtxAttr
|
||||
{
|
||||
inline bool IsScaleOne(u32 flags)
|
||||
{
|
||||
return (flags & 0x40000000);
|
||||
}
|
||||
|
||||
inline u32 AnmScaleOne(u32 flags)
|
||||
{
|
||||
return (flags | 0x40000000);
|
||||
}
|
||||
|
||||
inline u32 AnmNotScaleOne(u32 flags)
|
||||
{
|
||||
return (flags & 0x3fffffff);
|
||||
}
|
||||
|
||||
inline u32 AnmScaleUniform(u32 flags)
|
||||
{
|
||||
return (flags | 0x10000000);
|
||||
}
|
||||
|
||||
inline u32 AnmNotScaleUniform(u32 flags)
|
||||
{
|
||||
return (flags & 0x0fffffff);
|
||||
}
|
||||
}
|
||||
|
||||
namespace dcc
|
||||
{
|
||||
u32 CalcWorldMtx_Basic(math::MTX34 *, math::VEC3 *, const math::MTX34 *, const math::VEC3 *, u32, const ChrAnmResult *);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef NW4R_G3D_CALC_VIEW_H
|
||||
#define NW4R_G3D_CALC_VIEW_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
void CalcView(math::MTX34 *, math::MTX33 *, const math::MTX34 *, const u32 *,
|
||||
u32, const math::MTX34 *, ResMdl, math::MTX34 *);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef NW4R_G3D_CALC_WORLD_H
|
||||
#define NW4R_G3D_CALC_WORLD_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *,
|
||||
ResMdl, AnmObjChr *, FuncObjCalcWorld *, u32);
|
||||
|
||||
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *,
|
||||
ResMdl, AnmObjChr *, FuncObjCalcWorld *);
|
||||
|
||||
void CalcSkinning(math::MTX34 *, u32 *, ResMdl, const u8 *);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
#ifndef NW4R_G3D_CAMERA_H
|
||||
#define NW4R_G3D_CAMERA_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "math_types.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/MTX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct CameraData {
|
||||
math::MTX34 mCamMtx; // at 0x0
|
||||
math::MTX44 mProjMtx; // at 0x30
|
||||
u32 mFlags;
|
||||
math::VEC3 mPos; // at 0x74
|
||||
math::VEC3 VEC3_0x80;
|
||||
math::VEC3 VEC3_0x8C;
|
||||
math::VEC3 VEC3_0x98;
|
||||
f32 FLOAT_0xA4;
|
||||
u32 INT_0xA8;
|
||||
f32 FLOAT_0xAC;
|
||||
f32 FLOAT_0xB0;
|
||||
f32 FLOAT_0xB4;
|
||||
f32 FLOAT_0xB8;
|
||||
f32 FLOAT_0xBC;
|
||||
f32 FLOAT_0xC0;
|
||||
f32 FLOAT_0xC4;
|
||||
f32 FLOAT_0xC8;
|
||||
f32 FLOAT_0xCC;
|
||||
f32 FLOAT_0xD0;
|
||||
f32 FLOAT_0xD4;
|
||||
f32 FLOAT_0xD8;
|
||||
f32 FLOAT_0xDC;
|
||||
f32 FLOAT_0xE0;
|
||||
f32 FLOAT_0xE4;
|
||||
f32 FLOAT_0xE8;
|
||||
f32 FLOAT_0xEC;
|
||||
f32 FLOAT_0xF0;
|
||||
u32 INT_0xF4;
|
||||
u32 INT_0xF8;
|
||||
u32 INT_0xFC;
|
||||
u32 INT_0x100;
|
||||
u32 INT_0x104;
|
||||
u32 INT_0x108;
|
||||
};
|
||||
|
||||
struct Camera {
|
||||
struct PostureInfo {
|
||||
u32 INT_0x0;
|
||||
math::VEC3 VEC3_0x04;
|
||||
math::VEC3 VEC3_0x10;
|
||||
math::VEC3 VEC3_0x1C;
|
||||
f32 FLOAT_0x28;
|
||||
// . . .
|
||||
};
|
||||
|
||||
ResCommon<CameraData> mCamData;
|
||||
|
||||
inline Camera(void *vptr) : mCamData(vptr) {}
|
||||
inline void UpdateProjectionMtx() const {
|
||||
CameraData &rCamData = mCamData.ref();
|
||||
|
||||
if (rCamData.mFlags & 0x40) {
|
||||
C_MTXOrtho(rCamData.mProjMtx, rCamData.FLOAT_0xBC, rCamData.FLOAT_0xC0, rCamData.FLOAT_0xC4,
|
||||
rCamData.FLOAT_0xC8, rCamData.FLOAT_0xB4, rCamData.FLOAT_0xB8);
|
||||
} else {
|
||||
if (rCamData.mFlags & 0x10) {
|
||||
C_MTXFrustum(rCamData.mProjMtx, rCamData.FLOAT_0xBC, rCamData.FLOAT_0xC0, rCamData.FLOAT_0xC4,
|
||||
rCamData.FLOAT_0xC8, rCamData.FLOAT_0xB4, rCamData.FLOAT_0xB8);
|
||||
} else {
|
||||
C_MTXPerspective(rCamData.mProjMtx, rCamData.FLOAT_0xAC, rCamData.FLOAT_0xB0, rCamData.FLOAT_0xB4,
|
||||
rCamData.FLOAT_0xB8);
|
||||
}
|
||||
}
|
||||
|
||||
rCamData.mFlags |= 0x80;
|
||||
}
|
||||
|
||||
Camera(CameraData *);
|
||||
void Init();
|
||||
void Init(u16, u16, u16, u16, u16, u16);
|
||||
void SetPosition(f32, f32, f32);
|
||||
void SetPosition(const math::VEC3 &);
|
||||
void SetPosture(const PostureInfo &);
|
||||
void SetCameraMtxDirectly(const math::MTX34 &);
|
||||
void SetPerspective(f32, f32, f32, f32);
|
||||
void SetOrtho(f32, f32, f32, f32, f32, f32);
|
||||
void SetProjectionMtxDirectly(const math::MTX44 *);
|
||||
void SetScissor(u32, u32, u32, u32);
|
||||
void SetScissorBoxOffset(s32, s32);
|
||||
void SetViewport(f32, f32, f32, f32);
|
||||
void SetViewportZRange(f32, f32);
|
||||
void GetViewport(f32 *, f32 *, f32 *, f32 *, f32 *, f32 *) const;
|
||||
void GetCameraMtx(math::MTX34 *) const;
|
||||
void GetProjectionMtx(math::MTX44 *) const;
|
||||
void GetProjectionTexMtx(math::MTX34 *) const;
|
||||
void GetEnvironmentTexMtx(math::MTX34 *) const;
|
||||
void GXSetViewport() const;
|
||||
void GXSetProjection() const;
|
||||
void GXSetScissor() const;
|
||||
void GXSetScissorBoxOffset() const;
|
||||
void UpdateCameraMtx() const;
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef NW4R_G3D_CPU_H
|
||||
#define NW4R_G3D_CPU_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
void Copy32ByteBlocks(void *, const void *, u32);
|
||||
void ZeroMemory32ByteBlocks(void *, u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef NW4R_G3D_DCC_H
|
||||
#define NW4R_G3D_DCC_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_anmtexsrt.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
void CalcTexMtx(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag,
|
||||
TexSrtTypedef::TexMatrixMode);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef NW4R_G3D_DRAW_H
|
||||
#define NW4R_G3D_DRAW_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_resmdl.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct DrawResMdlReplacement
|
||||
{
|
||||
};
|
||||
|
||||
void DrawResMdlDirectly(ResMdl, const math::MTX34 *, const math::MTX33 *,
|
||||
const math::MTX34 *, const u8 *, const u8 *, DrawResMdlReplacement *, u32);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef NW4R_G3D_DRAW1_MAT1_SHP_H
|
||||
#define NW4R_G3D_DRAW1_MAT1_SHP_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_resmat.h"
|
||||
#include "g3d_resshp.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct Draw1Mat1ShpSwap
|
||||
{
|
||||
};
|
||||
|
||||
void Draw1Mat1ShpDirectly(ResMat, ResShp, const math::MTX34 *,
|
||||
const math::MTX34 *, u32, Draw1Mat1ShpSwap *, G3DState::IndMtxOp *);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef NW4R_G3D_FOG_H
|
||||
#define NW4R_G3D_FOG_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "math_types.h"
|
||||
#include "types_nw4r.h"
|
||||
#include "ut_Color.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct FogData {
|
||||
GXFogType mFogType; // at 0x0
|
||||
f32 mStartZ; // at 0x4
|
||||
f32 mEndZ; // at 0x8
|
||||
f32 mNear; // at 0xC
|
||||
f32 mFar; // at 0x10
|
||||
GXColor mColor; // at 0x14
|
||||
u8 mFogRangeAdjEnable; // at 0x18
|
||||
u8 BYTE_0x19;
|
||||
u16 mAdjTableWidth; // at 0x1A
|
||||
GXFogAdjTable mAdjTable; // at 0x1C
|
||||
};
|
||||
|
||||
struct Fog {
|
||||
ResCommon<FogData> mFogData;
|
||||
|
||||
inline Fog(void *vptr) : mFogData(vptr) {}
|
||||
|
||||
Fog(FogData *);
|
||||
void Init();
|
||||
void *CopyTo(void *) const;
|
||||
void SetFogRangeAdjParam(u16, u16, const math::MTX44 &);
|
||||
void SetGP() const;
|
||||
|
||||
bool IsValid() const {
|
||||
return mFogData.IsValid();
|
||||
}
|
||||
|
||||
bool IsFogRangeAdjEnable() const {
|
||||
return (IsValid() && mFogData.ref().mFogRangeAdjEnable != 1) ? true : false;
|
||||
}
|
||||
|
||||
void SetFogColor(GXColor c) {
|
||||
if (IsValid()) {
|
||||
mFogData.ref().mColor = c;
|
||||
}
|
||||
}
|
||||
|
||||
void SetFogType(GXFogType fog) {
|
||||
if (IsValid()) {
|
||||
mFogData.ref().mFogType = fog;
|
||||
}
|
||||
}
|
||||
|
||||
void SetNearFar(f32 near, f32 far) {
|
||||
if (IsValid()) {
|
||||
FogData &ref = mFogData.ref();
|
||||
ref.mNear = near;
|
||||
ref.mFar = far;
|
||||
}
|
||||
}
|
||||
|
||||
void SetZ(f32 start, f32 end) {
|
||||
if (IsValid()) {
|
||||
FogData &ref = mFogData.ref();
|
||||
ref.mStartZ = start;
|
||||
ref.mEndZ = end;
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef NW4R_G3D_GPU_H
|
||||
#define NW4R_G3D_GPU_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "math_types.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
namespace fifo {
|
||||
const u8 cm2hw[] = {0x00, 0x02, 0x01, 0x03};
|
||||
|
||||
inline void LoadXFCmd(u16 us, u32 ul) {
|
||||
GXCmd1u8(FIFO_ACCESS_XF);
|
||||
GXCmd1u16(0);
|
||||
GXCmd1u16(us);
|
||||
GXCmd1u32(ul);
|
||||
}
|
||||
|
||||
inline void LoadBPCmd(u32 ul) {
|
||||
GXCmd1u8(FIFO_ACCESS_BP);
|
||||
GXCmd1u32(ul);
|
||||
}
|
||||
|
||||
inline void LoadXFCmdHdr(u16 us, u8 uc) {
|
||||
GXCmd1u8(FIFO_ACCESS_XF);
|
||||
GXCmd1u16((u16)(uc - 1));
|
||||
GXCmd1u16(us);
|
||||
}
|
||||
|
||||
inline void LoadCPCmd(u8 uc, u32 ul) {
|
||||
GXCmd1u8(FIFO_ACCESS_CP);
|
||||
GXCmd1u8(uc);
|
||||
GXCmd1u32(ul);
|
||||
}
|
||||
|
||||
void GDSetGenMode2(u8, u8, u8, u8, GXCullMode);
|
||||
void GDSetCullMode(GXCullMode);
|
||||
void GDSetTexCoordScale2(GXTexCoordID, u16, u8, u8, u16, u8, u8);
|
||||
void GDSetIndTexMtx(u32, const math::MTX34 &);
|
||||
void GDResetCurrentMtx();
|
||||
void GDSetCurrentMtx(const u32 *);
|
||||
void GDLoadTexMtxImm3x3(const math::MTX33 &, u32);
|
||||
} // namespace fifo
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef NW4R_G3D_INIT_H
|
||||
#define NW4R_G3D_INIT_H
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/OS.h>
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
inline void InitFastCast() {
|
||||
OSInitFastCast();
|
||||
OSSetGQR6(7, 5);
|
||||
OSSetGQR7(7, 8);
|
||||
}
|
||||
|
||||
void G3dInit(bool);
|
||||
void G3dReset();
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,151 @@
|
||||
#ifndef NW4R_G3D_LIGHT_H
|
||||
#define NW4R_G3D_LIGHT_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct LightSetData {
|
||||
static const int NUM_LIGHTS = 8;
|
||||
|
||||
s8 mLights[NUM_LIGHTS]; // at 0x0
|
||||
s8 mAmbient; // at 0x8
|
||||
char UNK_0x8[3]; // at 0x9
|
||||
};
|
||||
|
||||
struct AmbLightObj {
|
||||
u8 r, g, b, a;
|
||||
};
|
||||
|
||||
struct AmbLightAnmResult {};
|
||||
|
||||
class LightObj {
|
||||
private:
|
||||
enum LightObjFlag {
|
||||
SPOT_LIGHT = 0x1,
|
||||
SPECULAR_LIGHT = 0x2,
|
||||
ENABLED = 0x4,
|
||||
SPECULAR_DIR = 0x8,
|
||||
COLOR_ENABLE = 0x10,
|
||||
ALPHA_ENABLE = 0x20
|
||||
};
|
||||
|
||||
public:
|
||||
LightObj() : mFlags() {}
|
||||
|
||||
operator GXLightObj *() {
|
||||
return &mLightObj;
|
||||
}
|
||||
operator const GXLightObj *() const {
|
||||
return &mLightObj;
|
||||
}
|
||||
|
||||
LightObj &operator=(const LightObj &rhs);
|
||||
|
||||
bool IsSpotLight() const {
|
||||
return mFlags & SPOT_LIGHT;
|
||||
}
|
||||
bool IsSpecularLight() const {
|
||||
return mFlags & SPECULAR_LIGHT;
|
||||
}
|
||||
bool IsEnable() const {
|
||||
return mFlags & ENABLED;
|
||||
}
|
||||
bool IsSpecularDir() const {
|
||||
return mFlags & SPECULAR_DIR;
|
||||
}
|
||||
bool IsColorEnable() const {
|
||||
return mFlags & COLOR_ENABLE;
|
||||
}
|
||||
bool IsAlphaEnable() const {
|
||||
return mFlags & ALPHA_ENABLE;
|
||||
}
|
||||
bool IsDiffuseLight() const {
|
||||
return !IsSpotLight() && !IsSpecularLight();
|
||||
}
|
||||
|
||||
void Enable() {
|
||||
mFlags |= ENABLED;
|
||||
}
|
||||
void Disable() {
|
||||
mFlags &= ~ENABLED;
|
||||
}
|
||||
|
||||
void Clear();
|
||||
void InitLightColor(GXColor);
|
||||
void InitLightPos(f32, f32, f32);
|
||||
void InitLightDir(f32, f32, f32);
|
||||
void InitSpecularDir(f32, f32, f32);
|
||||
void InitLightSpot(f32, GXSpotFn);
|
||||
void InitLightAttnA(f32, f32, f32);
|
||||
void InitLightDistAttn(f32, f32, GXDistAttnFn);
|
||||
void InitLightAttnK(f32, f32, f32);
|
||||
void InitLightShininess(f32);
|
||||
void GetLightPos(math::VEC3 *) const;
|
||||
void GetLightDir(math::VEC3 *) const;
|
||||
void ApplyViewMtx(const math::MTX34 &rMtx);
|
||||
|
||||
private:
|
||||
u32 mFlags; // at 0x0
|
||||
GXLightObj mLightObj; // at 0x4
|
||||
};
|
||||
|
||||
struct LightAnmResult {};
|
||||
|
||||
struct LightSet {
|
||||
LightSet(LightSetting *setting, LightSetData *data) : mSetting(setting), mLightSetData(data) {}
|
||||
|
||||
bool IsValid() const {
|
||||
return mSetting != NULL && mLightSetData != NULL;
|
||||
}
|
||||
|
||||
bool SelectLightObj(u32, int);
|
||||
bool SelectAmbLightObj(int);
|
||||
|
||||
LightSetting *mSetting; // at 0x0
|
||||
LightSetData *mLightSetData; // at 0x4
|
||||
};
|
||||
|
||||
class LightSetting {
|
||||
public:
|
||||
LightSetting(LightObj *, AmbLightObj *, u32, LightSetData *, u32);
|
||||
bool Import(const LightSetting &);
|
||||
void ApplyViewMtx(const math::MTX34 &, u32);
|
||||
|
||||
u16 GetNumLightObj() const {
|
||||
return mNumLightObj;
|
||||
}
|
||||
u16 GetNumLightSet() const {
|
||||
return mNumLightSet;
|
||||
}
|
||||
LightObj *GetLightObjArray() const {
|
||||
return mLightObjArray;
|
||||
}
|
||||
AmbLightObj *GetAmbLightObjArray() const {
|
||||
return mAmbLightObjArray;
|
||||
}
|
||||
LightSetData *GetLightSetDataArray() const {
|
||||
return mLightSetDataArray;
|
||||
}
|
||||
|
||||
LightSet GetLightSet(int i) {
|
||||
if (i < mNumLightSet && i > 0) {
|
||||
return LightSet(this, &mLightSetDataArray[i]);
|
||||
}
|
||||
|
||||
return LightSet(this, NULL);
|
||||
}
|
||||
|
||||
private:
|
||||
u16 mNumLightObj; // at 0x0
|
||||
u16 mNumLightSet; // at 0x2
|
||||
LightObj *mLightObjArray; // at 0x4
|
||||
AmbLightObj *mAmbLightObjArray; // at 0x8
|
||||
LightSetData *mLightSetDataArray; // at 0xC
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef NW4R_G3D_MAYA_H
|
||||
#define NW4R_G3D_MAYA_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_anmtexsrt.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace dcc
|
||||
{
|
||||
bool CalcTexMtx_Maya(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,130 @@
|
||||
#ifndef NW4R_G3D_G3DOBJ_H
|
||||
#define NW4R_G3D_G3DOBJ_H
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/MEM/mem_allocator.h>
|
||||
|
||||
#define NW4R_G3D_TYPE_OBJ_DECL(VAL) static const nw4r::g3d::G3dObj::ResNameDataT<sizeof(#VAL)> TYPE_NAME
|
||||
#define NW4R_G3D_TYPE_OBJ_DEF(VAL) \
|
||||
const nw4r::g3d::G3dObj::ResNameDataT<sizeof(#VAL)> VAL::TYPE_NAME = {sizeof(#VAL), #VAL}
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
namespace detail {
|
||||
inline void *AllocFromAllocator(MEMAllocator *pAllocator, u32 size) {
|
||||
return MEMAllocFromAllocator(pAllocator, size);
|
||||
}
|
||||
|
||||
inline void FreeToAllocator(MEMAllocator *pAllocator, void *pBlock) {
|
||||
return MEMFreeToAllocator(pAllocator, pBlock);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
class G3dObj {
|
||||
public:
|
||||
enum G3dProcTask {
|
||||
G3DPROC_CALC_WORLD = 0x1,
|
||||
G3DPROC_CALC_MAT = 0x2,
|
||||
G3DPROC_CALC_VTX = 0x3,
|
||||
G3DPROC_CALC_VIEW = 0x4,
|
||||
G3DPROC_GATHER_SCNOBJ = 0x5,
|
||||
G3DPROC_DRAW_OPA = 0x6,
|
||||
G3DPROC_DRAW_XLU = 0x7,
|
||||
G3DPROC_UPDATEFRAME = 0x8,
|
||||
|
||||
G3DPROC_CHILD_DETACHED = 0x10001,
|
||||
G3DPROC_ATTACH_PARENT = 0x10002,
|
||||
G3DPROC_DETACH_PARENT = 0x10003,
|
||||
G3DPROC_0x10004 = 0x10004
|
||||
};
|
||||
|
||||
template <u32 N>
|
||||
struct ResNameDataT {
|
||||
u32 mLength;
|
||||
// Bug? +1 seemingly for null terminator,
|
||||
// but size N already includes it
|
||||
char mName[N + 1 + 3 & ~3];
|
||||
};
|
||||
|
||||
struct TypeObj {
|
||||
struct TypeObjData {
|
||||
u32 mLength; // at 0x0
|
||||
char mName[]; // at 0x4
|
||||
};
|
||||
|
||||
template <u32 N>
|
||||
TypeObj(const ResNameDataT<N> &pRes) : mData((const TypeObjData *)&pRes) {}
|
||||
|
||||
u32 GetTypeID() const {
|
||||
return (u32)mData;
|
||||
}
|
||||
|
||||
const char *GetTypeName() const {
|
||||
return mData->mName;
|
||||
}
|
||||
|
||||
bool operator==(const TypeObj &rhs) const {
|
||||
return GetTypeID() == rhs.GetTypeID();
|
||||
}
|
||||
|
||||
const TypeObjData *mData; // at 0x0
|
||||
};
|
||||
|
||||
public:
|
||||
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
|
||||
{
|
||||
return other == GetTypeObjStatic();
|
||||
}
|
||||
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
|
||||
virtual ~G3dObj(); // at 0x10
|
||||
virtual const TypeObj GetTypeObj() const // at 0x14
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
virtual const char *GetTypeName() const // at 0x18
|
||||
{
|
||||
return GetTypeObj().GetTypeName();
|
||||
}
|
||||
|
||||
static const G3dObj::TypeObj GetTypeObjStatic() {
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
void Destroy();
|
||||
|
||||
G3dObj(MEMAllocator *pAllocator, G3dObj *pParent) : mAllocator(pAllocator), mParent(pParent) {}
|
||||
|
||||
G3dObj *GetParent() const {
|
||||
return mParent;
|
||||
}
|
||||
void SetParent(G3dObj *parent) {
|
||||
mParent = parent;
|
||||
}
|
||||
|
||||
static void *Alloc(MEMAllocator *pAllocator, u32 size) {
|
||||
return detail::AllocFromAllocator(pAllocator, size);
|
||||
}
|
||||
|
||||
static void Dealloc(MEMAllocator *pAllocator, void *pBlock) {
|
||||
detail::FreeToAllocator(pAllocator, pBlock);
|
||||
}
|
||||
|
||||
static inline void *operator new(size_t size, void *pBlock) {
|
||||
return pBlock;
|
||||
}
|
||||
static inline void operator delete(void *pBlock) {}
|
||||
|
||||
template <typename T>
|
||||
static T *DynamicCast(G3dObj *obj) {
|
||||
return (obj != NULL && obj->IsDerivedFrom(T::GetTypeObjStatic())) ? static_cast<T *>(obj) : NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
G3dObj *mParent; // at 0x4
|
||||
MEMAllocator *mAllocator; // at 0x8
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(G3dObj);
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef NW4R_G3D_RESANM_H
|
||||
#define NW4R_G3D_RESANM_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResKeyFrameAnmFramesData
|
||||
{
|
||||
float mTime; // at 0x0
|
||||
float mValue; // at 0x4
|
||||
float mDerivative; // at 0x8
|
||||
};
|
||||
|
||||
struct ResKeyFrameAnmData
|
||||
{
|
||||
u16 mCount; // at 0x0
|
||||
float FLOAT_0x4;
|
||||
ResKeyFrameAnmFramesData mFrames[]; // at 0x8
|
||||
};
|
||||
|
||||
struct ResColorAnmFramesData
|
||||
{
|
||||
u32 mColor; // at 0x0
|
||||
};
|
||||
|
||||
union ResColorAnmData
|
||||
{
|
||||
u32 mColor;
|
||||
s32 mOffset;
|
||||
};
|
||||
|
||||
struct ResBoolAnmFramesData
|
||||
{
|
||||
u32 mFlags; // at 0x0
|
||||
};
|
||||
|
||||
union ResAnmData
|
||||
{
|
||||
float mValue;
|
||||
s32 mOffset;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
float GetResKeyFrameAnmResult(const ResKeyFrameAnmData *, float);
|
||||
|
||||
u32 GetResColorAnmResult(const ResColorAnmFramesData *, float);
|
||||
|
||||
inline u32 GetResColorAnmResult(const ResColorAnmData * pData, float time, bool b)
|
||||
{
|
||||
if (b) return pData->mColor;
|
||||
|
||||
return GetResColorAnmResult((const ResColorAnmFramesData *)((u8 *)pData + pData->mOffset), time);
|
||||
}
|
||||
|
||||
inline bool GetResBoolAnmFramesResult(const ResBoolAnmFramesData * pData, int i)
|
||||
{
|
||||
u32 index = i;
|
||||
|
||||
u32 mask = 0x80000000 >> (index % 32);
|
||||
u32 flags = pData[index / 32].mFlags;
|
||||
|
||||
return flags & mask;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline float ClipFrame(T & info, float time)
|
||||
{
|
||||
if (time <= 0.0f) return 0.0f;
|
||||
|
||||
if (info.mNumFrames <= time) return info.mNumFrames;
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
inline float GetResAnmResult(const ResAnmData * pData, float time, bool b)
|
||||
{
|
||||
if (b) return pData->mValue;
|
||||
|
||||
return GetResKeyFrameAnmResult((const ResKeyFrameAnmData *)((u8 *)pData + pData->mOffset), time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef NW4R_G3D_RESANMCAMERA_H
|
||||
#define NW4R_G3D_RESANMCAMERA_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_anmcamera.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmCameraData
|
||||
{
|
||||
char UNK_0x0[0xC];
|
||||
u32 mID; // at 0xC
|
||||
};
|
||||
|
||||
struct ResAnmCamera
|
||||
{
|
||||
ResCommon<ResAnmCameraData> mAnmCamera;
|
||||
|
||||
inline ResAnmCamera(void * vptr) : mAnmCamera(vptr) {}
|
||||
|
||||
bool IsValid() const { return mAnmCamera.IsValid(); }
|
||||
|
||||
void GetAnmResult(CameraAnmResult *, f32) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef NW4R_G3D_RESANMCHR_H
|
||||
#define NW4R_G3D_RESANMCHR_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmChrData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmChr
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 4
|
||||
};
|
||||
|
||||
ResCommon<ResAnmChrData> mAnmChr;
|
||||
|
||||
inline ResAnmChr(void * vptr) : mAnmChr(vptr) {}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return mAnmChr.ref().mRevision == REVISION;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef NW4R_G3D_RESANMCLR_H
|
||||
#define NW4R_G3D_RESANMCLR_H
|
||||
#include "g3d_resdict.h"
|
||||
#include "g3d_resanm.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmClrInfoData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u16 mNumFrames;
|
||||
};
|
||||
|
||||
struct ResAnmClrMatData
|
||||
{
|
||||
char UNK_0x0[0x4];
|
||||
u32 mFlags; // at 0x4
|
||||
|
||||
struct AnmData
|
||||
{
|
||||
UNKWORD WORD_0x0;
|
||||
ResColorAnmData mColor; // at 0x4
|
||||
} mAnms[]; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmClrData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
char UNK_0xC[0x4];
|
||||
s32 mMatDictOffset; // at 0x10
|
||||
ResAnmClrInfoData mInfo; // at 0x14
|
||||
};
|
||||
|
||||
struct ResAnmClr
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 3
|
||||
};
|
||||
|
||||
ResCommon<ResAnmClrData> mAnmClr;
|
||||
|
||||
inline ResAnmClr(void * vptr) : mAnmClr(vptr) {}
|
||||
|
||||
inline ResAnmClrData & ref() const
|
||||
{
|
||||
return mAnmClr.ref();
|
||||
}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
inline const ResAnmClrMatData * GetMatAnm(u32 i) const
|
||||
{
|
||||
return static_cast<const ResAnmClrMatData *>(mAnmClr.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
|
||||
}
|
||||
|
||||
void GetAnmResult(ClrAnmResult *, u32, float) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef NW4R_G3D_RESANMFOG_H
|
||||
#define NW4R_G3D_RESANMFOG_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_anmfog.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmFogData
|
||||
{
|
||||
char UNK_0x0[0xC];
|
||||
u32 mID; // at 0xC
|
||||
};
|
||||
|
||||
struct ResAnmFog
|
||||
{
|
||||
ResCommon<ResAnmFogData> mAnmFog;
|
||||
|
||||
inline ResAnmFog(void * vptr) : mAnmFog(vptr) {}
|
||||
|
||||
void GetAnmResult(FogAnmResult *, f32) const;
|
||||
|
||||
bool IsValid() const { return mAnmFog.IsValid(); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef NW4R_G3D_RESANMSCN_H
|
||||
#define NW4R_G3D_RESANMSCN_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_resanmfog.h"
|
||||
#include "g3d_resanmcamera.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmScnData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
char UNK_0xC[0x3E - 0xC];
|
||||
u16 mFogMaxRefNum; // at 0x3E
|
||||
};
|
||||
|
||||
struct ResAnmScn
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 4
|
||||
};
|
||||
|
||||
ResCommon<ResAnmScnData> mAnmScn;
|
||||
|
||||
ResAnmFog GetResAnmFogByRefNumber(u32) const;
|
||||
ResAnmCamera GetResAnmCameraByRefNumber(u32) const;
|
||||
|
||||
inline ResAnmScn(void * vptr) : mAnmScn(vptr) {}
|
||||
|
||||
inline bool IsValid() const { return mAnmScn.IsValid(); }
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return mAnmScn.ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
u16 GetResAnmFogMaxRefNumber() const { return mAnmScn.ref().mFogMaxRefNum; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef NW4R_G3D_RESANMSHP_H
|
||||
#define NW4R_G3D_RESANMSHP_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmShpData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmShp
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 3
|
||||
};
|
||||
|
||||
ResCommon<ResAnmShpData> mAnmShp;
|
||||
|
||||
inline ResAnmShp(void * vptr) : mAnmShp(vptr) {}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return mAnmShp.ref().mRevision == REVISION;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef NW4R_G3D_RESANMTEXPAT_H
|
||||
#define NW4R_G3D_RESANMTEXPAT_H
|
||||
#include "g3d_resdict.h"
|
||||
#include "g3d_resanm.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmTexPatAnmFramesData
|
||||
{
|
||||
float mTime; // at 0x0
|
||||
u16 mTexIndex; // at 0x4
|
||||
u16 mPlttIndex; // at 0x6
|
||||
};
|
||||
|
||||
struct ResAnmTexPatAnmData
|
||||
{
|
||||
u16 mCount; // at 0x0
|
||||
float FLOAT_0x4;
|
||||
ResAnmTexPatAnmFramesData mFrames[]; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmTexPatMatData
|
||||
{
|
||||
char UNK_0x0[0x4];
|
||||
u32 mFlags; // at 0x4
|
||||
|
||||
union AnmData
|
||||
{
|
||||
struct
|
||||
{
|
||||
u16 mTexIndex; // at 0x0
|
||||
u16 mPlttIndex; // at 0x2
|
||||
};
|
||||
|
||||
s32 mOffset;
|
||||
} mAnms[]; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmTexPatData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
char UNK_0xC[0x4];
|
||||
s32 mMatDictOffset; // at 0x10
|
||||
s32 mTexNameArrayOffset; // at 0x14
|
||||
s32 mPlttNameArrayOffset; // at 0x18
|
||||
s32 mTexArrayOffset; // at 0x1c
|
||||
s32 mPlttArrayOffset; // at 0x20
|
||||
char UNK_0x24[0xC];
|
||||
u16 mTexCount; // at 0x30
|
||||
u16 mPlttCount; // at 0x32
|
||||
};
|
||||
|
||||
struct ResAnmTexPat
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 3
|
||||
};
|
||||
|
||||
ResCommon<ResAnmTexPatData> mAnmTexPat;
|
||||
|
||||
inline ResAnmTexPat(void * vptr) : mAnmTexPat(vptr) {}
|
||||
|
||||
inline ResAnmTexPatData & ref() const
|
||||
{
|
||||
return mAnmTexPat.ref();
|
||||
}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
inline const ResAnmTexPatMatData * GetMatAnm(u32 i) const
|
||||
{
|
||||
return static_cast<const ResAnmTexPatMatData *>(mAnmTexPat.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
|
||||
}
|
||||
|
||||
void GetAnmResult(TexPatAnmResult *, u32, float) const;
|
||||
|
||||
bool Bind(ResFile);
|
||||
void Release();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef NW4R_G3D_RESANMTEXSRT_H
|
||||
#define NW4R_G3D_RESANMTEXSRT_H
|
||||
#include "g3d_resanm.h"
|
||||
#include "g3d_resdict.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmTexSrtTexData
|
||||
{
|
||||
u32 mFlags; // at 0x0
|
||||
ResAnmData mAnms[]; // at 0x4
|
||||
};
|
||||
|
||||
struct ResAnmTexSrtMatData
|
||||
{
|
||||
char UNK_0x0[0x4];
|
||||
UNKWORD FLAGS_0x4;
|
||||
UNKWORD FLAGS_0x8;
|
||||
s32 mTexOffsets[]; // at 0xc
|
||||
};
|
||||
|
||||
struct ResAnmTexSrtData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
char UNK_0xC[0x4];
|
||||
s32 mMatDictOffset; // at 0x10
|
||||
};
|
||||
|
||||
struct ResAnmTexSrt
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 4
|
||||
};
|
||||
|
||||
ResCommon<ResAnmTexSrtData> mAnmTexSrt;
|
||||
|
||||
inline ResAnmTexSrt(void * vptr) : mAnmTexSrt(vptr) {}
|
||||
|
||||
inline ResAnmTexSrtData & ref() const
|
||||
{
|
||||
return mAnmTexSrt.ref();
|
||||
}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return mAnmTexSrt.ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
inline const ResAnmTexSrtMatData * GetMatAnm(u32 i) const
|
||||
{
|
||||
return static_cast<const ResAnmTexSrtMatData *>(mAnmTexSrt.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
|
||||
}
|
||||
|
||||
void GetAnmResult(TexSrtAnmResult *, u32, float) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,82 @@
|
||||
#ifndef NW4R_G3D_RESANMVIS_H
|
||||
#define NW4R_G3D_RESANMVIS_H
|
||||
#include "g3d_resdict.h"
|
||||
#include "g3d_resanm.h"
|
||||
#include "g3d_anmobj.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResAnmVisInfoData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u16 mNumFrames; // at 0x1C
|
||||
u16 mNumNodes;
|
||||
AnmPolicy mAnmPolicy; // at 0x20
|
||||
};
|
||||
|
||||
struct ResAnmVisNodeData
|
||||
{
|
||||
UNKWORD WORD_0x0;
|
||||
u32 mFlags; // at 0x4
|
||||
ResBoolAnmFramesData mBoolFrames[]; // at 0x8
|
||||
};
|
||||
|
||||
struct ResAnmVisData
|
||||
{
|
||||
char UNK_0x0[0x8];
|
||||
u32 mRevision; // at 0x8
|
||||
char UNK_0xC[0x4];
|
||||
s32 mNodeDictOffset; // at 0x10
|
||||
ResAnmVisInfoData mInfo; // at 0x14
|
||||
};
|
||||
|
||||
struct ResAnmVis
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 3
|
||||
};
|
||||
|
||||
ResCommon<ResAnmVisData> mAnmVis;
|
||||
|
||||
inline ResAnmVis(void * vptr) : mAnmVis(vptr) {}
|
||||
bool IsValid() const { return mAnmVis.IsValid(); }
|
||||
|
||||
inline ResAnmVisData & ref() const
|
||||
{
|
||||
return mAnmVis.ref();
|
||||
}
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
inline const ResAnmVisNodeData * GetNodeAnm(u32 i) const
|
||||
{
|
||||
return static_cast<const ResAnmVisNodeData *>(mAnmVis.ofs_to_obj<ResDic>(ref().mNodeDictOffset)[i]);
|
||||
}
|
||||
|
||||
AnmPolicy GetAnmPolicy() const
|
||||
{
|
||||
return ref().mInfo.mAnmPolicy;
|
||||
}
|
||||
|
||||
int GetNumFrame() const
|
||||
{
|
||||
return ref().mInfo.mNumFrames;
|
||||
}
|
||||
|
||||
int GetNumNode() const
|
||||
{
|
||||
return ref().mInfo.mNumNodes;
|
||||
}
|
||||
|
||||
bool GetAnmResult(u32, float) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,141 @@
|
||||
#ifndef NW4R_G3D_RESCOMMON_H
|
||||
#define NW4R_G3D_RESCOMMON_H
|
||||
#include "types_nw4r.h"
|
||||
|
||||
#define NW4R_G3D_CREATE_RES_NAME_DATA(VAR,VAL) ResNameData ResNameData_##VAR = { sizeof(VAL) - 1, VAL }
|
||||
|
||||
#define FIFO_ACCESS_BP 0x61
|
||||
#define FIFO_ACCESS_CP 0x8
|
||||
#define FIFO_ACCESS_XF 0x10
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
template <typename T>
|
||||
class ResCommon
|
||||
{
|
||||
T * mPtr;
|
||||
|
||||
public:
|
||||
inline ResCommon(void * vptr) : mPtr(static_cast<T *>(vptr)) {}
|
||||
inline ResCommon(const void * vptr) : mPtr(static_cast<T *>(vptr)) {}
|
||||
|
||||
inline T & ref() const { return *mPtr; }
|
||||
inline T * ptr() const { return mPtr; }
|
||||
inline bool IsValid() const { return mPtr != NULL; }
|
||||
|
||||
template <typename TPtr>
|
||||
inline const TPtr * ofs_to_ptr_raw(s32 ofs) const
|
||||
{
|
||||
return (const TPtr *)((u8 *)mPtr + ofs);
|
||||
}
|
||||
|
||||
template <typename TPtr>
|
||||
inline TPtr * ofs_to_ptr(s32 ofs)
|
||||
{
|
||||
if (ofs) return (TPtr *)((u8 *)mPtr + ofs);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <typename TPtr>
|
||||
inline const TPtr * ofs_to_ptr(s32 ofs) const
|
||||
{
|
||||
if (ofs) return (const TPtr *)((u8 *)mPtr + ofs);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <typename TObj>
|
||||
inline TObj ofs_to_obj(s32 ofs) const
|
||||
{
|
||||
if (ofs) return (u8 *)mPtr + ofs;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct ResNameData
|
||||
{
|
||||
u32 mLength;
|
||||
char mName[0x1C];
|
||||
};
|
||||
|
||||
struct ResName
|
||||
{
|
||||
ResCommon<const ResNameData> mRes;
|
||||
|
||||
inline ResName(const void *vptr) : mRes(vptr) {}
|
||||
|
||||
inline u32 GetLength() const
|
||||
{
|
||||
return mRes.ref().mLength;
|
||||
}
|
||||
|
||||
inline const char * GetName() const
|
||||
{
|
||||
return mRes.ref().mName;
|
||||
}
|
||||
|
||||
bool operator==(ResName) const;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
typedef u8 CPCmd[6];
|
||||
typedef u8 BPCmd[5];
|
||||
|
||||
inline void ResWrite_u8(u8 *res, u8 arg)
|
||||
{
|
||||
*res = arg;
|
||||
}
|
||||
|
||||
inline void ResWrite_u16(u8 *res, u16 arg)
|
||||
{
|
||||
ResWrite_u8(res + 0, arg >> 8);
|
||||
ResWrite_u8(res + 1, arg >> 0);
|
||||
}
|
||||
|
||||
inline void ResWrite_u32(u8 *res, u32 arg)
|
||||
{
|
||||
ResWrite_u8(res + 0, arg >> 24);
|
||||
ResWrite_u8(res + 1, arg >> 16);
|
||||
ResWrite_u8(res + 2, arg >> 8);
|
||||
ResWrite_u8(res + 3, arg >> 0);
|
||||
}
|
||||
|
||||
inline u8 ResRead_u8(const u8 *res)
|
||||
{
|
||||
return *res;
|
||||
}
|
||||
|
||||
inline u32 ResRead_u32(const u8 *res)
|
||||
{
|
||||
int ret = ResRead_u8(res) << 24;
|
||||
ret |= ResRead_u8(res + 1) << 16;
|
||||
ret |= ResRead_u8(res + 2) << 8;
|
||||
ret |= ResRead_u8(res + 3);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void ResReadBPCmd(const u8 *res, u32 *out)
|
||||
{
|
||||
*out = ResRead_u32(res + 1);
|
||||
}
|
||||
|
||||
inline void ResReadCPCmd(const u8 *res, u32 *out)
|
||||
{
|
||||
*out = ResRead_u32(res + 2);
|
||||
}
|
||||
|
||||
void ResWriteBPCmd(u8 *, u32);
|
||||
void ResWriteBPCmd(u8 *, u32, u32);
|
||||
void ResWriteCPCmd(u8 *, u8, u32);
|
||||
void ResWriteXFCmd(u8 *, u16, u32);
|
||||
void ResWriteSSMask(u8 *, u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef NW4R_G3D_RESDICT_H
|
||||
#define NW4R_G3D_RESDICT_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResDicEntry
|
||||
{
|
||||
u16 INT_0x0; // at 0x0
|
||||
u16 INT_0x2; // at 0x2
|
||||
u16 unk_index; // at 0x4
|
||||
u16 unk_index2; // at 0x6
|
||||
u32 INT_0x8; // at 0x8
|
||||
u32 INT_0xC; // at 0xC
|
||||
};
|
||||
|
||||
struct ResDicData
|
||||
{
|
||||
u32 mSize; // at 0x0
|
||||
u32 mNumData; // at 0x4
|
||||
ResDicEntry mEntries[]; // 0x8
|
||||
};
|
||||
|
||||
struct ResDic
|
||||
{
|
||||
ResCommon<ResDicData> mDict;
|
||||
|
||||
ResDicEntry * Get(ResName) const;
|
||||
ResDicEntry * Get(const char *, u32) const;
|
||||
void * operator[](const char *) const;
|
||||
void * operator[](ResName) const;
|
||||
s32 GetIndex(ResName) const;
|
||||
|
||||
inline ResDic(void * vptr) : mDict(vptr) {}
|
||||
|
||||
inline void * operator[](int i) const
|
||||
{
|
||||
if (mDict.IsValid()) return (void *)mDict.ofs_to_ptr<void>(mDict.ref().mEntries[i + 1].INT_0xC);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline u32 GetNumData() const
|
||||
{
|
||||
if (mDict.IsValid()) return mDict.ref().mNumData;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,15 +1,92 @@
|
||||
#pragma once
|
||||
#ifndef NW4R_G3D_RESFILE_H
|
||||
#define NW4R_G3D_RESFILE_H
|
||||
#include "ut_binaryFileFormat.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_resdict.h"
|
||||
#include "types_nw4r.h"
|
||||
|
||||
#include <common.h>
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
|
||||
struct ResFileData
|
||||
{
|
||||
ut::BinaryFileHeader mHeader; // at 0x0
|
||||
|
||||
ut::BinaryBlockHeader mRootHeader; // at 0x10
|
||||
ResDicData mRootData; // at 0x18
|
||||
};
|
||||
|
||||
struct ResFile
|
||||
{
|
||||
ResCommon<ResFileData> mFile; // at 0x0
|
||||
|
||||
inline ResFileData & ref() const
|
||||
{
|
||||
return mFile.ref();
|
||||
}
|
||||
|
||||
ResMdl GetResMdl(const char *) const;
|
||||
ResMdl GetResMdl(int) const;
|
||||
ResMdl GetResMdl(u32) const; //inlined
|
||||
|
||||
ResPltt GetResPltt(const char *) const;
|
||||
ResPltt GetResPltt(ResName) const;
|
||||
ResPltt GetResPltt(int) const;
|
||||
ResPltt GetResPltt(u32) const; //inlined
|
||||
|
||||
ResTex GetResTex(const char *) const;
|
||||
ResTex GetResTex(ResName) const;
|
||||
ResTex GetResTex(int) const;
|
||||
ResTex GetResTex(u32) const; //inlined
|
||||
|
||||
ResAnmChr GetResAnmChr(const char *) const;
|
||||
ResAnmChr GetResAnmChr(int) const;
|
||||
ResAnmChr GetResAnmChr(u32) const; //inlined
|
||||
|
||||
ResAnmVis GetResAnmVis(const char *) const;
|
||||
ResAnmVis GetResAnmVis(int) const;
|
||||
ResAnmVis GetResAnmVis(u32) const; //inlined
|
||||
|
||||
ResAnmClr GetResAnmClr(const char *) const;
|
||||
ResAnmClr GetResAnmClr(int) const;
|
||||
ResAnmClr GetResAnmClr(u32) const; //inlined
|
||||
|
||||
ResAnmTexPat GetResAnmTexPat(const char *) const;
|
||||
ResAnmTexPat GetResAnmTexPat(int) const;
|
||||
ResAnmTexPat GetResAnmTexPat(u32) const; //inlined
|
||||
|
||||
ResAnmTexSrt GetResAnmTexSrt(const char *) const;
|
||||
ResAnmTexSrt GetResAnmTexSrt(int) const;
|
||||
ResAnmTexSrt GetResAnmTexSrt(u32) const; //inlined
|
||||
|
||||
ResAnmShp GetResAnmShp(const char *) const;
|
||||
ResAnmShp GetResAnmShp(int) const;
|
||||
ResAnmShp GetResAnmShp(u32) const; //inlined
|
||||
|
||||
ResAnmScn GetResAnmScn(const char *) const;
|
||||
ResAnmScn GetResAnmScn(int) const;
|
||||
ResAnmScn GetResAnmScn(u32) const; //inlined
|
||||
|
||||
u32 GetResMdlNumEntries() const; //inlined
|
||||
u32 GetResPlttNumEntries() const; //inlined
|
||||
u32 GetResTexNumEntries() const; //inlined
|
||||
u32 GetResAnmChrNumEntries() const; //inlined
|
||||
u32 GetResAnmVisNumEntries() const; //inlined
|
||||
u32 GetResAnmClrNumEntries() const; //inlined
|
||||
u32 GetResAnmTexPatNumEntries() const; //inlined
|
||||
u32 GetResAnmTexSrtNumEntries() const; //inlined
|
||||
u32 GetResAnmShpNumEntries() const; //inlined
|
||||
u32 GetResAnmScnNumEntries() const;
|
||||
|
||||
bool Bind(ResFile);
|
||||
void Release();
|
||||
void Init();
|
||||
void Terminate();
|
||||
bool CheckRevision() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
|
||||
struct ResFileData {};
|
||||
|
||||
struct ResFile {
|
||||
/* data */
|
||||
};
|
||||
|
||||
}; // namespace g3d
|
||||
}; // namespace nw4r
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef NW4R_G3D_RESMAT_H
|
||||
#define NW4R_G3D_RESMAT_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "math_types.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct ResMatTexCoordGenData {};
|
||||
|
||||
struct ResMatTexCoordGen {
|
||||
ResCommon<ResMatTexCoordGenData> mTexGen; // at 0x0
|
||||
|
||||
inline ResMatTexCoordGen(void *vptr) : mTexGen(vptr) {}
|
||||
bool IsValid() const {
|
||||
return mTexGen.IsValid();
|
||||
}
|
||||
|
||||
bool GXGetTexCoordGen2(GXTexCoordID, GXTexGenType *, GXTexGenSrc *, u8 *, u32 *);
|
||||
void GXSetTexCoordGen2(GXTexCoordID, GXTexGenType, GXTexGenSrc, u8, u32);
|
||||
void DCStore(bool);
|
||||
};
|
||||
|
||||
struct ResTexSrtData {};
|
||||
|
||||
struct ResTexSrt {
|
||||
ResCommon<ResTexSrtData> mTexSrt; // at 0x0
|
||||
|
||||
inline ResTexSrt(void *vptr) : mTexSrt(vptr) {}
|
||||
bool IsValid() const {
|
||||
return mTexSrt.IsValid();
|
||||
}
|
||||
|
||||
void SetMapMode(u32, u32, int, int);
|
||||
};
|
||||
|
||||
struct ResTexPlttInfoData {
|
||||
u32 mNumOffsets; // at 0x0
|
||||
|
||||
struct InfoOffset {
|
||||
u32 mResOffset; // at 0x0
|
||||
u32 mTexOffset; // at 0x4
|
||||
} mOffsets[]; // at 0x4
|
||||
};
|
||||
|
||||
struct ResTexPlttInfo {
|
||||
ResCommon<ResTexPlttInfoData> mInfo;
|
||||
|
||||
inline ResTexPlttInfo(void *vptr) : mInfo(vptr) {}
|
||||
};
|
||||
|
||||
struct ResMatDLData {
|
||||
char UNK_0x0[0xE0];
|
||||
ResMatTexCoordGenData texCoordGenData; // at 0xE0
|
||||
};
|
||||
|
||||
struct ResMatData {
|
||||
char UNK_0x0[0x38];
|
||||
u32 resMatDLOfs; // at 0x38
|
||||
char UNK_0x3C[0x1A4 - 0x3C];
|
||||
ResTexSrtData texSrtData; // at 0x1A4
|
||||
};
|
||||
|
||||
struct ResMat {
|
||||
ResCommon<ResMatData> mMat;
|
||||
|
||||
inline ResMat(void *vptr) : mMat(vptr) {}
|
||||
bool IsValid() const {
|
||||
return mMat.IsValid();
|
||||
}
|
||||
|
||||
ResTexSrt GetResTexSrt() {
|
||||
return ResTexSrt(&mMat.ref().texSrtData);
|
||||
}
|
||||
|
||||
ResMatTexCoordGen GetResMatTexCoordGen() {
|
||||
ResMatDLData *dlData = mMat.ofs_to_ptr<ResMatDLData>(mMat.ref().resMatDLOfs);
|
||||
return ResMatTexCoordGen(&dlData->texCoordGenData);
|
||||
}
|
||||
|
||||
bool Bind(ResFile);
|
||||
UNKTYPE Release();
|
||||
UNKTYPE Init();
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
#ifndef NW4R_G3D_RESMDL_H
|
||||
#define NW4R_G3D_RESMDL_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_resnode.h"
|
||||
#include "g3d_resdict.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResMdlData
|
||||
{
|
||||
char mMagic[4]; // "MDL0"
|
||||
u32 INT_0x4;
|
||||
u32 mRevision; // at 0x8
|
||||
s32 INT_0xC;
|
||||
u32 mByteCodeDictOfs; // at 0x10
|
||||
u32 mNodeDictOfs; // at 0x14
|
||||
u32 mVtxPosDictOfs; // at 0x18
|
||||
u32 mVtxNrmDictOfs; // at 0x1C
|
||||
u32 mVtxClrDictOfs; // at 0x20
|
||||
u32 mVtxTexCoordDictOfs; // at 0x24
|
||||
u32 mMatDictOfs; // at 0x28
|
||||
u32 mTevDictOfs; // at 0x2C
|
||||
u32 mShpDictOfs; // at 0x30
|
||||
u32 mPlttTexInfoOfs; // at 0x34
|
||||
};
|
||||
|
||||
struct ResMdl
|
||||
{
|
||||
enum
|
||||
{
|
||||
REVISION = 9
|
||||
};
|
||||
|
||||
ResCommon<ResMdlData> mMdl;
|
||||
|
||||
inline ResMdl(void * vptr) : mMdl(vptr) {}
|
||||
bool IsValid() const { return mMdl.IsValid(); }
|
||||
|
||||
u8 * GetResByteCode(const char *) const;
|
||||
|
||||
ResNode GetResNode(const char *) const;
|
||||
ResNode GetResNode(ResName) const;
|
||||
ResNode GetResNode(int) const;
|
||||
ResNode GetResNode(u32) const;
|
||||
u32 GetResNodeNumEntries() const;
|
||||
|
||||
ResVtxPos GetResVtxPos(ResName) const;
|
||||
ResVtxPos GetResVtxPos(int) const;
|
||||
ResVtxPos GetResVtxPos(u32) const;
|
||||
u32 GetResVtxPosNumEntries() const;
|
||||
|
||||
ResVtxNrm GetResVtxNrm(ResName) const;
|
||||
ResVtxNrm GetResVtxNrm(int) const;
|
||||
ResVtxNrm GetResVtxNrm(u32) const;
|
||||
u32 GetResVtxNrmNumEntries() const;
|
||||
|
||||
ResVtxClr GetResVtxClr(ResName) const;
|
||||
ResVtxClr GetResVtxClr(int) const;
|
||||
ResVtxClr GetResVtxClr(u32) const;
|
||||
u32 GetResVtxClrNumEntries() const;
|
||||
|
||||
ResVtxTexCoord GetResVtxTexCoord(int) const;
|
||||
|
||||
ResMat GetResMat(const char *) const;
|
||||
ResMat GetResMat(ResName) const;
|
||||
ResMat GetResMat(int) const;
|
||||
ResMat GetResMat(u32) const;
|
||||
u32 GetResMatNumEntries() const;
|
||||
|
||||
ResShp GetResShp(const char *) const;
|
||||
ResShp GetResShp(int) const;
|
||||
ResShp GetResShp(u32) const;
|
||||
u32 GetResShpNumEntries() const;
|
||||
|
||||
ResTexPlttInfo GetResTexPlttInfoOffsetFromTexName(int) const;
|
||||
u32 GetResTexPlttInfoOffsetFromTexNameNumEntries() const;
|
||||
|
||||
bool Bind(ResFile);
|
||||
void Release();
|
||||
void Init();
|
||||
void Terminate();
|
||||
|
||||
inline bool CheckRevision() const
|
||||
{
|
||||
return mMdl.ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
inline u32 GetResVtxTexCoordNumEntries() const
|
||||
{
|
||||
ResMdlData& ref = mMdl.ref();
|
||||
return mMdl.ofs_to_obj<ResDic>(ref.mVtxTexCoordDictOfs).GetNumData();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef NW4R_G3D_RESNODE_H
|
||||
#define NW4R_G3D_RESNODE_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_anmchr.h"
|
||||
#include "math_types.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResNodeData
|
||||
{
|
||||
u32 INT_0x0;
|
||||
s32 INT_0x4;
|
||||
u16 SHORT_0x8;
|
||||
u16 SHORT_0xA;
|
||||
UNKWORD WORD_0xC;
|
||||
UNKWORD WORD_0x10;
|
||||
u32 mFlags; // at 0x14
|
||||
UNKWORD WORD_0x18;
|
||||
UNKWORD WORD_0x1C;
|
||||
math::VEC3 VEC3_0x20;
|
||||
math::VEC3 VEC3_0x2C;
|
||||
f32 FLOAT_0x38;
|
||||
f32 FLOAT_0x3C;
|
||||
f32 FLOAT_0x40;
|
||||
// . . .
|
||||
};
|
||||
|
||||
struct ResNode
|
||||
{
|
||||
enum ResNodeFlags
|
||||
{
|
||||
NODE_IS_VISIBLE = 0x100
|
||||
};
|
||||
|
||||
ResCommon<ResNodeData> mNode;
|
||||
|
||||
inline ResNode(void * vptr) : mNode(vptr) {}
|
||||
|
||||
bool IsValid() const { return mNode.IsValid(); }
|
||||
|
||||
UNKWORD GetID() const
|
||||
{
|
||||
if (IsValid())
|
||||
return mNode.ptr()->WORD_0xC;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetVisibility(bool visible)
|
||||
{
|
||||
if (IsValid())
|
||||
{
|
||||
if (visible)
|
||||
mNode.ptr()->mFlags |= NODE_IS_VISIBLE;
|
||||
else
|
||||
mNode.ptr()->mFlags &= ~NODE_IS_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
void PatchChrAnmResult(ChrAnmResult *) const;
|
||||
void CalcChrAnmResult(ChrAnmResult *) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,122 @@
|
||||
#ifndef NW4R_G3D_RESSHP_H
|
||||
#define NW4R_G3D_RESSHP_H
|
||||
#include <GXAttr.h>
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_rescommon.h"
|
||||
#include "g3d_resmdl.h"
|
||||
#include "g3d_resvtx.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResTagDLData
|
||||
{
|
||||
u32 mBufSize; // at 0x0
|
||||
u32 mCmdSize; // at 0x4
|
||||
u32 mOffset; // at 0x8
|
||||
};
|
||||
|
||||
struct ResPrePrimDL
|
||||
{
|
||||
char UNK_0x0[0xA];
|
||||
detail::CPCmd CP_CMD_0xA;
|
||||
detail::CPCmd CP_CMD_0x10;
|
||||
char UNK_0x16[0xA];
|
||||
detail::CPCmd CP_CMD_0x20;
|
||||
detail::CPCmd CP_CMD_0x26;
|
||||
detail::CPCmd CP_CMD_0x2C;
|
||||
detail::CPCmd CP_CMD_PAIRS_0x32[GX_POS_MTX_ARRAY - GX_VA_POS][2];
|
||||
char UNK_0xC2[0x1E];
|
||||
};
|
||||
|
||||
struct ResShpData
|
||||
{
|
||||
char UNK_0x0[0x4];
|
||||
u32 mParentOffset; // at 0x4
|
||||
char UNK_0x8[0x10];
|
||||
ResTagDLData mPrePrimDLTag; // at 0x18
|
||||
ResTagDLData mPrimDLTag; // at 0x24
|
||||
char UNK_0x30[0x18];
|
||||
|
||||
s16 mVtxPosIndex; // at 0x48
|
||||
s16 mVtxNrmIndex; // at 0x4a
|
||||
s16 mVtxClrIndices[GX_VA_TEX0 - GX_VA_CLR0]; // at 0x4c
|
||||
s16 mVtxTexCoordIndices[GX_POS_MTX_ARRAY - GX_VA_TEX0]; // at 0x50
|
||||
};
|
||||
|
||||
struct ResTagDL
|
||||
{
|
||||
ResCommon<ResTagDLData> mData;
|
||||
|
||||
inline ResTagDL(void * vptr) : mData(vptr) {}
|
||||
|
||||
inline u8 * GetDL() const
|
||||
{
|
||||
return const_cast<u8 *>(mData.ofs_to_ptr<u8>(mData.ref().mOffset));
|
||||
}
|
||||
|
||||
inline u32 GetBufSize() const
|
||||
{
|
||||
return mData.ref().mBufSize;
|
||||
}
|
||||
|
||||
inline u32 GetCmdSize() const
|
||||
{
|
||||
return mData.ref().mCmdSize;
|
||||
}
|
||||
};
|
||||
|
||||
struct ResShpPrePrim
|
||||
{
|
||||
ResCommon<ResPrePrimDL> mDL;
|
||||
|
||||
inline ResShpPrePrim(void * vptr) : mDL(vptr) {}
|
||||
|
||||
inline ResPrePrimDL & ref() const
|
||||
{
|
||||
return mDL.ref();
|
||||
}
|
||||
};
|
||||
|
||||
struct ResShp
|
||||
{
|
||||
ResCommon<ResShpData> mShp;
|
||||
|
||||
inline ResShp(void * vptr) : mShp(vptr) {}
|
||||
bool IsValid() const { return mShp.IsValid(); }
|
||||
|
||||
inline ResShpData & ref() const
|
||||
{
|
||||
return mShp.ref();
|
||||
}
|
||||
|
||||
inline ResShpPrePrim GetResShpPrePrim() const
|
||||
{
|
||||
return ResTagDL(&ref().mPrePrimDLTag).GetDL();
|
||||
}
|
||||
|
||||
bool GXGetVtxDescv(GXVtxDescList*) const;
|
||||
bool GXGetVtxAttrFmtv(GXVtxAttrFmtList*) const;
|
||||
|
||||
ResMdl GetParent() const; //inlined
|
||||
|
||||
ResVtxPos GetResVtxPos() const;
|
||||
ResVtxNrm GetResVtxNrm() const;
|
||||
ResVtxClr GetResVtxClr(u32) const;
|
||||
ResVtxTexCoord GetResVtxTexCoord(u32) const; //inlined
|
||||
|
||||
void GXSetArray(GXAttr, const void *, u8); //inlined
|
||||
|
||||
void Init();
|
||||
|
||||
void DisableSetArray(GXAttr); //inlined
|
||||
void Terminate();
|
||||
|
||||
void CallPrePrimitiveDisplayList(bool, bool) const;
|
||||
void CallPrimitiveDisplayList(bool) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef NW4R_G3D_RESTEV_H
|
||||
#define NW4R_G3D_RESTEV_H
|
||||
#include <GXTev.h>
|
||||
#include <GXTexture.h>
|
||||
#include "g3d_cpu.h"
|
||||
#include "g3d_rescommon.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResTevData
|
||||
{
|
||||
u32 SIZE_0x0;
|
||||
u32 INT_0x4;
|
||||
char UNK_0x8[0x4];
|
||||
u8 BYTE_0xC;
|
||||
char UNK_0xD[0x13];
|
||||
|
||||
detail::BPCmd mSwapSelCmds[GX_MAX_TEVSWAP][4];
|
||||
|
||||
char UNK_0x70[0x10];
|
||||
|
||||
struct
|
||||
{
|
||||
detail::BPCmd BP_CMD_0x0;
|
||||
detail::BPCmd BP_CMD_0x5;
|
||||
detail::BPCmd BP_CMD_0xA;
|
||||
detail::BPCmd BP_CMD_PAIR_0xF[2];
|
||||
char UNK_0x19[0x17];
|
||||
} mStageCmds[];//[GX_TEV_STAGE_COUNT];
|
||||
};
|
||||
|
||||
struct ResTev
|
||||
{
|
||||
ResCommon<ResTevData> mTev;
|
||||
|
||||
inline ResTev(void * vptr) : mTev(vptr) {}
|
||||
|
||||
inline ResTevData & ref() const
|
||||
{
|
||||
return mTev.ref();
|
||||
}
|
||||
|
||||
bool GXGetTevSwapModeTable(GXTevSwapSel, GXTevColorChan *, GXTevColorChan *, GXTevColorChan *, GXTevColorChan *) const;
|
||||
void GXSetTevSwapModeTable(GXTevSwapSel, GXTevColorChan, GXTevColorChan, GXTevColorChan, GXTevColorChan);
|
||||
|
||||
bool GXGetTevOrder(GXTevStageID, GXTexCoordID *, GXTexMapID *, GXChannelID *) const;
|
||||
|
||||
void GXSetTevColorIn(GXTevStageID, GXTevColorArg, GXTevColorArg, GXTevColorArg, GXTevColorArg);
|
||||
|
||||
void CallDisplayList(bool) const;
|
||||
|
||||
void * CopyTo(void *);
|
||||
|
||||
UNKTYPE DCStore(bool);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef NW4R_G3D_RESTEX_H
|
||||
#define NW4R_G3D_RESTEX_H
|
||||
#include "g3d_rescommon.h"
|
||||
#include "types_nw4r.h"
|
||||
#include <rvl/GX.h>
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace g3d {
|
||||
struct ResTexData {
|
||||
char mMagic[4]; // "TEX0"; at 0x0
|
||||
u32 mLength; // at 0x4
|
||||
u32 mRevision; // at 0x8
|
||||
s16 SHORT_0xC;
|
||||
u16 SHORT_0xE;
|
||||
u32 INT_0x10;
|
||||
UNKWORD WORD_0x14;
|
||||
u32 mFlags; // at 0x18
|
||||
u16 SHORT_0x1C;
|
||||
u16 SHORT_0x1E;
|
||||
union // at 0x20
|
||||
{
|
||||
GXTexFmt mFormat;
|
||||
GXCITexFmt mCiFormat;
|
||||
};
|
||||
u32 WORD_0x24;
|
||||
f32 FLOAT_0x28;
|
||||
f32 FLOAT_0x2C;
|
||||
};
|
||||
|
||||
struct ResPlttData {
|
||||
char mMagic[4]; // "PLT0"; at 0x0
|
||||
u32 mLength; // at 0x4
|
||||
u32 mRevision; // at 0x8
|
||||
};
|
||||
|
||||
struct ResTex {
|
||||
enum { REVISION = 1 };
|
||||
|
||||
ResCommon<ResTexData> mTex; // at 0x0
|
||||
|
||||
inline ResTex(void *vptr) : mTex(vptr) {}
|
||||
|
||||
inline bool CheckRevision() const {
|
||||
return mTex.ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
bool GetTexObjParam(void **, u16 *, u16 *, GXTexFmt *, f32 *, f32 *, u8 *) const;
|
||||
bool GetTexObjCIParam(void **, u16 *, u16 *, GXCITexFmt *, f32 *, f32 *, u8 *) const;
|
||||
void Init();
|
||||
|
||||
bool IsValid() const {
|
||||
return mTex.IsValid();
|
||||
}
|
||||
};
|
||||
|
||||
struct ResPltt {
|
||||
enum { REVISION = 1 };
|
||||
|
||||
ResCommon<ResPlttData> mPltt; // at 0x0
|
||||
|
||||
inline ResPltt(void *vptr) : mPltt(vptr) {}
|
||||
|
||||
inline bool CheckRevision() const {
|
||||
return mPltt.ref().mRevision == REVISION;
|
||||
}
|
||||
|
||||
void DCStore(bool);
|
||||
};
|
||||
} // namespace g3d
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,158 @@
|
||||
#ifndef NW4R_G3D_RESVTX_H
|
||||
#define NW4R_G3D_RESVTX_H
|
||||
#include <GXAttr.h>
|
||||
#include "g3d_rescommon.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
struct ResVtxPosData
|
||||
{
|
||||
u32 SIZE_0x0;
|
||||
char UNK_0x4[0x4];
|
||||
u32 mDataOffset; // at 0x8
|
||||
char UNK_0xC[0x11];
|
||||
u8 BYTE_0x1D;
|
||||
};
|
||||
|
||||
struct ResVtxNrmData
|
||||
{
|
||||
u32 SIZE_0x0;
|
||||
char UNK_0x4[0x4];
|
||||
u32 mDataOffset; // at 0x8
|
||||
char UNK_0xC[0x11];
|
||||
u8 BYTE_0x1D;
|
||||
};
|
||||
|
||||
struct ResVtxClrData
|
||||
{
|
||||
u32 SIZE_0x0;
|
||||
char UNK_0x4[0x4];
|
||||
u32 mDataOffset; // at 0x8
|
||||
char UNK_0xC[0x10];
|
||||
u8 BYTE_0x1C;
|
||||
};
|
||||
|
||||
struct ResVtxTexCoordData
|
||||
{
|
||||
u32 SIZE_0x0;
|
||||
char UNK_0x4[0x4];
|
||||
u32 mDataOffset; // at 0x8
|
||||
char UNK_0xC[0x11];
|
||||
u8 BYTE_0x1D;
|
||||
};
|
||||
|
||||
struct ResVtxPos
|
||||
{
|
||||
ResCommon<ResVtxPosData> mPos;
|
||||
|
||||
inline ResVtxPos(void * vptr) : mPos(vptr) {}
|
||||
|
||||
inline ResVtxPosData & ref() const
|
||||
{
|
||||
return mPos.ref();
|
||||
}
|
||||
|
||||
inline const void * GetData() const
|
||||
{
|
||||
return mPos.ofs_to_ptr<void>(ref().mDataOffset);
|
||||
}
|
||||
|
||||
inline UNKTYPE Init()
|
||||
{
|
||||
DCStore(false);
|
||||
}
|
||||
|
||||
void SetArray();
|
||||
void GetArray(const void **, u8 *) const;
|
||||
UNKTYPE CopyTo(void *) const;
|
||||
|
||||
UNKTYPE DCStore(bool);
|
||||
};
|
||||
|
||||
struct ResVtxNrm
|
||||
{
|
||||
ResCommon<ResVtxNrmData> mNrm;
|
||||
|
||||
inline ResVtxNrm(void * vptr) : mNrm(vptr) {}
|
||||
|
||||
inline ResVtxNrmData & ref() const
|
||||
{
|
||||
return mNrm.ref();
|
||||
}
|
||||
|
||||
inline const void * GetData() const
|
||||
{
|
||||
return mNrm.ofs_to_ptr<void>(ref().mDataOffset);
|
||||
}
|
||||
|
||||
inline UNKTYPE Init()
|
||||
{
|
||||
DCStore(false);
|
||||
}
|
||||
|
||||
void SetArray();
|
||||
void GetArray(const void **, u8 *) const;
|
||||
UNKTYPE CopyTo(void *) const;
|
||||
|
||||
UNKTYPE DCStore(bool);
|
||||
};
|
||||
|
||||
struct ResVtxClr
|
||||
{
|
||||
ResCommon<ResVtxClrData> mClr;
|
||||
|
||||
inline ResVtxClr(void * vptr) : mClr(vptr) {}
|
||||
|
||||
inline ResVtxClrData & ref() const
|
||||
{
|
||||
return mClr.ref();
|
||||
}
|
||||
|
||||
inline const void * GetData() const
|
||||
{
|
||||
return mClr.ofs_to_ptr<void>(ref().mDataOffset);
|
||||
}
|
||||
|
||||
inline UNKTYPE Init()
|
||||
{
|
||||
DCStore(false);
|
||||
}
|
||||
|
||||
void SetArray(GXAttr);
|
||||
void GetArray(const void **, u8 *) const;
|
||||
UNKTYPE CopyTo(void *) const;
|
||||
|
||||
UNKTYPE DCStore(bool);
|
||||
};
|
||||
|
||||
struct ResVtxTexCoord
|
||||
{
|
||||
ResCommon<ResVtxTexCoordData> mTexCoord;
|
||||
|
||||
inline ResVtxTexCoord(void * vptr) : mTexCoord(vptr) {}
|
||||
|
||||
inline ResVtxTexCoordData & ref() const
|
||||
{
|
||||
return mTexCoord.ref();
|
||||
}
|
||||
|
||||
inline const void * GetData() const
|
||||
{
|
||||
return mTexCoord.ofs_to_ptr<void>(ref().mDataOffset);
|
||||
}
|
||||
|
||||
inline UNKTYPE Init()
|
||||
{
|
||||
DCStore(false);
|
||||
}
|
||||
|
||||
void GetArray(const void **, u8 *) const;
|
||||
|
||||
UNKTYPE DCStore(bool);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef NW4R_G3D_SCN_MDL_H
|
||||
#define NW4R_G3D_SCN_MDL_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_scnmdlsmpl.h"
|
||||
#include "g3d_resmat.h"
|
||||
#include "g3d_draw.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
class ScnMdl : public ScnMdlSimple
|
||||
{
|
||||
public:
|
||||
class CopiedMatAccess
|
||||
{
|
||||
public:
|
||||
CopiedMatAccess(ScnMdl *, u32);
|
||||
ResTexSrt GetResTexSrtEx();
|
||||
|
||||
private:
|
||||
char UNK_0x0[0x2C];
|
||||
};
|
||||
|
||||
public:
|
||||
static const G3dObj::TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
DrawResMdlReplacement * GetDrawResMdlReplacement() { return &mDrawMdlReplace; }
|
||||
|
||||
private:
|
||||
char UNK_0x118[0x144 - 0x118];
|
||||
DrawResMdlReplacement mDrawMdlReplace; // at 0x144
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef NW4R_G3D_SCN_MDL1_MAT1_SHP_H
|
||||
#define NW4R_G3D_SCN_MDL1_MAT1_SHP_H
|
||||
#include "types_nw4r.h"
|
||||
#include "g3d_scnobj.h"
|
||||
#include "g3d_resmat.h"
|
||||
#include "g3d_resshp.h"
|
||||
|
||||
namespace nw4r
|
||||
{
|
||||
namespace g3d
|
||||
{
|
||||
class ScnMdl1Mat1Shp : public ScnLeaf
|
||||
{
|
||||
public:
|
||||
static const G3dObj::TypeObj GetTypeObjStatic()
|
||||
{
|
||||
return TypeObj(TYPE_NAME);
|
||||
}
|
||||
|
||||
ResMat GetResMat() { return mResMat; }
|
||||
ResShp GetResShp() { return mResShp; }
|
||||
|
||||
private:
|
||||
ResMat mResMat; // at 0xE8
|
||||
ResShp mResShp; // at 0xEC
|
||||
|
||||
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl1Mat1Shp);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user