got rid of PluginBase inhertiance because ps2 gcc complained about non-POD types

This commit is contained in:
aap 2017-08-10 14:43:52 +02:00
parent 497796e550
commit f7988a5fcc
9 changed files with 55 additions and 32 deletions

View File

@ -12,6 +12,8 @@
namespace rw { namespace rw {
PluginList Camera::s_plglist = { sizeof(Camera), sizeof(Camera), nil, nil };
void void
defaultBeginUpdateCB(Camera *cam) defaultBeginUpdateCB(Camera *cam)
{ {

View File

@ -13,6 +13,9 @@
namespace rw { namespace rw {
PluginList Clump::s_plglist = { sizeof(Clump), sizeof(Clump), nil, nil };
PluginList Atomic::s_plglist = { sizeof(Atomic), sizeof(Atomic), nil, nil };
// //
// Clump // Clump
// //

View File

@ -12,6 +12,7 @@
namespace rw { namespace rw {
LinkList Frame::dirtyList; LinkList Frame::dirtyList;
PluginList Frame::s_plglist = { sizeof(Frame), sizeof(Frame), nil, nil };
Frame* Frame*
Frame::create(void) Frame::create(void)

View File

@ -14,6 +14,9 @@
namespace rw { namespace rw {
PluginList Geometry::s_plglist = { sizeof(Geometry), sizeof(Geometry), nil, nil };
PluginList Material::s_plglist = { sizeof(Material), sizeof(Material), nil, nil };
SurfaceProperties defaultSurfaceProps = { 1.0f, 1.0f, 1.0f }; SurfaceProperties defaultSurfaceProps = { 1.0f, 1.0f, 1.0f };
Geometry* Geometry*

View File

@ -24,6 +24,10 @@
namespace rw { namespace rw {
PluginList TexDictionary::s_plglist = { sizeof(TexDictionary), sizeof(TexDictionary), nil, nil };
PluginList Texture::s_plglist = { sizeof(Texture), sizeof(Texture), nil, nil };
PluginList Raster::s_plglist = { sizeof(Raster), sizeof(Raster), nil, nil };
// //
// TexDictionary // TexDictionary
// //

View File

@ -11,6 +11,8 @@
namespace rw { namespace rw {
PluginList Light::s_plglist = { sizeof(Light), sizeof(Light), nil, nil };
static void static void
lightSync(ObjectWithFrame*) lightSync(ObjectWithFrame*)
{ {

View File

@ -82,8 +82,9 @@ struct Object
} }
}; };
struct Frame : PluginBase<Frame> struct Frame
{ {
PLUGINBASE
typedef Frame *(*Callback)(Frame *f, void *data); typedef Frame *(*Callback)(Frame *f, void *data);
enum { ID = 0 }; enum { ID = 0 };
enum { // private flags enum { // private flags
@ -215,8 +216,9 @@ struct RasterLevels
} levels[1]; // 0 is illegal :/ } levels[1]; // 0 is illegal :/
}; };
struct Raster : PluginBase<Raster> struct Raster
{ {
PLUGINBASE
int32 platform; int32 platform;
int32 type; // hardly used int32 type; // hardly used
@ -268,8 +270,9 @@ struct Raster : PluginBase<Raster>
struct TexDictionary; struct TexDictionary;
struct Texture : PluginBase<Texture> struct Texture
{ {
PLUGINBASE
Raster *raster; Raster *raster;
TexDictionary *dict; TexDictionary *dict;
LLLink inDict; LLLink inDict;
@ -317,8 +320,9 @@ struct SurfaceProperties
float32 diffuse; float32 diffuse;
}; };
struct Material : PluginBase<Material> struct Material
{ {
PLUGINBASE
Texture *texture; Texture *texture;
RGBA color; RGBA color;
SurfaceProperties surfaceProps; SurfaceProperties surfaceProps;
@ -391,8 +395,9 @@ struct MaterialList
uint32 streamGetSize(void); uint32 streamGetSize(void);
}; };
struct Geometry : PluginBase<Geometry> struct Geometry
{ {
PLUGINBASE
enum { ID = 8 }; enum { ID = 8 };
Object object; Object object;
uint32 flags; uint32 flags;
@ -453,8 +458,9 @@ void registerNativeDataPlugin(void);
struct Clump; struct Clump;
struct World; struct World;
struct Atomic : PluginBase<Atomic> struct Atomic
{ {
PLUGINBASE
typedef void (*RenderCB)(Atomic *atomic); typedef void (*RenderCB)(Atomic *atomic);
enum { ID = 1 }; enum { ID = 1 };
enum { enum {
@ -509,8 +515,9 @@ struct Atomic : PluginBase<Atomic>
void registerAtomicRightsPlugin(void); void registerAtomicRightsPlugin(void);
struct Light : PluginBase<Light> struct Light
{ {
PLUGINBASE
enum { ID = 3 }; enum { ID = 3 };
ObjectWithFrame object; ObjectWithFrame object;
float32 radius; float32 radius;
@ -568,8 +575,9 @@ struct FrustumPlane
uint8 closestZ; uint8 closestZ;
}; };
struct Camera : PluginBase<Camera> struct Camera
{ {
PLUGINBASE
enum { ID = 4 }; enum { ID = 4 };
enum { PERSPECTIVE = 1, PARALLEL }; enum { PERSPECTIVE = 1, PARALLEL };
enum { CLEARIMAGE = 0x1, CLEARZ = 0x2}; enum { CLEARIMAGE = 0x1, CLEARZ = 0x2};
@ -625,8 +633,9 @@ struct Camera : PluginBase<Camera>
void setFOV(float32 fov, float32 ratio); void setFOV(float32 fov, float32 ratio);
}; };
struct Clump : PluginBase<Clump> struct Clump
{ {
PLUGINBASE
enum { ID = 2 }; enum { ID = 2 };
Object object; Object object;
LinkList atomics; LinkList atomics;
@ -664,8 +673,9 @@ struct Clump : PluginBase<Clump>
}; };
// A bit of a stub right now // A bit of a stub right now
struct World : PluginBase<World> struct World
{ {
PLUGINBASE
enum { ID = 7 }; enum { ID = 7 };
Object object; Object object;
LinkList lights; // these have positions (type >= 0x80) LinkList lights; // these have positions (type >= 0x80)
@ -676,8 +686,9 @@ struct World : PluginBase<World>
void addCamera(Camera *cam); void addCamera(Camera *cam);
}; };
struct TexDictionary : PluginBase<TexDictionary> struct TexDictionary
{ {
PLUGINBASE
enum { ID = 6 }; enum { ID = 6 };
Object object; Object object;
LinkList textures; LinkList textures;

View File

@ -49,27 +49,22 @@ struct PluginList
int32 getPluginOffset(uint32 id); int32 getPluginOffset(uint32 id);
}; };
template <typename T> #define PLUGINBASE \
struct PluginBase static PluginList s_plglist; \
{ static int32 registerPlugin(int32 size, uint32 id, Constructor ctor, \
static PluginList s_plglist; Destructor dtor, CopyConstructor copy){ \
return s_plglist.registerPlugin(size, id, ctor, dtor, copy); \
} \
static int32 registerPluginStream(uint32 id, StreamRead read, \
StreamWrite write, StreamGetSize getSize){ \
return s_plglist.registerStream(id, read, write, getSize); \
} \
static int32 setStreamRightsCallback(uint32 id, RightsCallback cb){ \
return s_plglist.setStreamRightsCallback(id, cb); \
} \
static int32 getPluginOffset(uint32 id){ \
return s_plglist.getPluginOffset(id); \
}
static int32 registerPlugin(int32 size, uint32 id, Constructor ctor,
Destructor dtor, CopyConstructor copy){
return s_plglist.registerPlugin(size, id, ctor, dtor, copy);
}
static int32 registerPluginStream(uint32 id, StreamRead read,
StreamWrite write, StreamGetSize getSize){
return s_plglist.registerStream(id, read, write, getSize);
}
static int32 setStreamRightsCallback(uint32 id, RightsCallback cb){
return s_plglist.setStreamRightsCallback(id, cb);
}
static int32 getPluginOffset(uint32 id){
return s_plglist.getPluginOffset(id);
}
};
template <typename T>
PluginList PluginBase<T>::s_plglist = { sizeof(T), sizeof(T), nil, nil };
} }

View File

@ -13,6 +13,8 @@
namespace rw { namespace rw {
PluginList World::s_plglist = { sizeof(World), sizeof(World), nil, nil };
World* World*
World::create(void) World::create(void)
{ {