mirror of
https://github.com/aap/librw.git
synced 2025-12-18 16:39:51 +00:00
fixed build for ps2
This commit is contained in:
14
src/base.cpp
14
src/base.cpp
@@ -35,16 +35,16 @@ char *debugFile = nil;
|
||||
// TODO: comparison tolerances
|
||||
|
||||
static Matrix identMat = {
|
||||
{ 1.0f, 0.0f, 0.0f}, 0.0f,
|
||||
{ 0.0f, 1.0f, 0.0f}, 0.0f,
|
||||
{ 0.0f, 0.0f, 1.0f}, 0.0f,
|
||||
{ 0.0f, 0.0f, 0.0f}, 1.0f
|
||||
V3d( 1.0f, 0.0f, 0.0f), 0.0f,
|
||||
V3d( 0.0f, 1.0f, 0.0f), 0.0f,
|
||||
V3d( 0.0f, 0.0f, 1.0f), 0.0f,
|
||||
V3d( 0.0f, 0.0f, 0.0f), 1.0f
|
||||
};
|
||||
|
||||
static Matrix3 identMat3 = {
|
||||
{ 1.0f, 0.0f, 0.0f},
|
||||
{ 0.0f, 1.0f, 0.0f},
|
||||
{ 0.0f, 0.0f, 1.0f}
|
||||
V3d( 1.0f, 0.0f, 0.0f),
|
||||
V3d( 0.0f, 1.0f, 0.0f),
|
||||
V3d( 0.0f, 0.0f, 1.0f)
|
||||
};
|
||||
|
||||
// lazy implementation
|
||||
|
||||
@@ -61,7 +61,7 @@ Clump::destroy(void)
|
||||
Light::fromClump(lnk)->destroy();
|
||||
FORLIST(lnk, this->cameras)
|
||||
Camera::fromClump(lnk)->destroy();
|
||||
if(f = this->getFrame())
|
||||
if(f = this->getFrame(), f)
|
||||
f->destroyHierarchy();
|
||||
free(this);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ using namespace d3d;
|
||||
|
||||
// TODO: move to header, but not as #define
|
||||
#ifndef RW_D3D9
|
||||
#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
|
||||
static VertexElement _d3ddec_end = {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0};
|
||||
#define D3DDECL_END() _d3ddec_end
|
||||
#endif
|
||||
|
||||
#define NUMDECLELT 12
|
||||
|
||||
@@ -93,7 +93,7 @@ Texture *readNativeTexture(Stream *stream);
|
||||
void writeNativeTexture(Texture *tex, Stream *stream);
|
||||
uint32 getSizeNativeTexture(Texture *tex);
|
||||
|
||||
enum : rw::uint32 {
|
||||
enum {
|
||||
D3DFMT_UNKNOWN = 0xFFFFFFFF,
|
||||
|
||||
/* Swizzled formats */
|
||||
|
||||
@@ -24,9 +24,10 @@ void
|
||||
Engine::init(void)
|
||||
{
|
||||
engine = new Engine;
|
||||
PluginList init = { sizeof(Driver), sizeof(Driver), nil, nil };
|
||||
|
||||
for(uint i = 0; i < NUM_PLATFORMS; i++)
|
||||
Driver::s_plglist[i] = { sizeof(Driver), sizeof(Driver), nil, nil };
|
||||
Driver::s_plglist[i] = init;
|
||||
|
||||
Frame::dirtyList.init();
|
||||
|
||||
|
||||
@@ -817,7 +817,7 @@ Material::streamRead(Stream *stream)
|
||||
if(version < 0x30400)
|
||||
mat->surfaceProps = defaultSurfaceProps;
|
||||
else
|
||||
stream->read(&mat->surfaceProps, sizeof(surfaceProps));
|
||||
stream->read(&mat->surfaceProps, sizeof(SurfaceProperties));
|
||||
if(buf.textured){
|
||||
if(!findChunk(stream, ID_TEXTURE, &length, nil)){
|
||||
RWERROR((ERR_CHUNK, "TEXTURE"));
|
||||
|
||||
@@ -229,7 +229,7 @@ Texture::read(const char *name, const char *mask)
|
||||
Raster *raster = nil;
|
||||
Texture *tex;
|
||||
|
||||
if(tex = Texture::findCB(name)){
|
||||
if(tex = Texture::findCB(name), tex){
|
||||
tex->refCount++;
|
||||
return tex;
|
||||
}
|
||||
@@ -452,11 +452,11 @@ decompressDXT1(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint8 idx[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h/2; j += 8){
|
||||
for(int32 j = 0; j < w*h/2; j += 8){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+0]);
|
||||
uint32 col1 = *((uint16*)&src[j+2]);
|
||||
@@ -519,12 +519,12 @@ decompressDXT3(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint8 idx[16];
|
||||
uint8 a[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h; j += 16){
|
||||
for(int32 j = 0; j < w*h; j += 16){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+8]);
|
||||
uint32 col1 = *((uint16*)&src[j+10]);
|
||||
@@ -577,13 +577,13 @@ decompressDXT5(uint8 *adst, int32 w, int32 h, uint8 *src)
|
||||
{
|
||||
/* j loops through old texels
|
||||
* x and y loop through new texels */
|
||||
uint32 x = 0, y = 0;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 c[4][4];
|
||||
uint32 a[8];
|
||||
uint8 idx[16];
|
||||
uint8 aidx[16];
|
||||
uint8 (*dst)[4] = (uint8(*)[4])adst;
|
||||
for(uint32 j = 0; j < w*h; j += 16){
|
||||
for(int32 j = 0; j < w*h; j += 16){
|
||||
/* calculate colors */
|
||||
uint32 col0 = *((uint16*)&src[j+8]);
|
||||
uint32 col1 = *((uint16*)&src[j+10]);
|
||||
|
||||
@@ -98,10 +98,10 @@ struct Driver
|
||||
extern Driver *driver[NUM_PLATFORMS];
|
||||
#define DRIVER driver[rw::platform]
|
||||
|
||||
inline void setRenderState(int32 state, uint32 value){
|
||||
inline void SetRenderState(int32 state, uint32 value){
|
||||
engine->setRenderState(state, value); }
|
||||
|
||||
inline uint32 getRenderState(int32 state){
|
||||
inline uint32 GetRenderState(int32 state){
|
||||
return engine->getRenderState(state); }
|
||||
|
||||
namespace null {
|
||||
|
||||
@@ -16,7 +16,7 @@ struct LLLink
|
||||
}
|
||||
};
|
||||
|
||||
#define LLLinkGetData(linkvar,type,entry) \
|
||||
#define LLLinkGetData(linkvar,type,entry) \
|
||||
((type*)(((uint8*)(linkvar))-offsetof(type,entry)))
|
||||
|
||||
// Have to be careful since the link might be deleted.
|
||||
|
||||
@@ -353,8 +353,8 @@ Skin::init(int32 numBones, int32 numUsedBones, int32 numVertices)
|
||||
|
||||
|
||||
|
||||
static_assert(sizeof(Skin::RLEcount) == 2, "RLEcount size");
|
||||
static_assert(sizeof(Skin::RLE) == 2, "RLE size");
|
||||
//static_assert(sizeof(Skin::RLEcount) == 2, "RLEcount size");
|
||||
//static_assert(sizeof(Skin::RLE) == 2, "RLE size");
|
||||
|
||||
void
|
||||
Skin::findNumWeights(int32 numVertices)
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace rw {
|
||||
World*
|
||||
World::create(void)
|
||||
{
|
||||
World *world = (World*)malloc(PluginBase::s_plglist.size);
|
||||
World *world = (World*)malloc(s_plglist.size);
|
||||
if(world == nil){
|
||||
RWERROR((ERR_ALLOC, PluginBase::s_plglist.size));
|
||||
RWERROR((ERR_ALLOC, s_plglist.size));
|
||||
return nil;
|
||||
}
|
||||
world->object.init(World::ID, 0);
|
||||
|
||||
Reference in New Issue
Block a user